fix(app): stop select theme color transitions

This commit is contained in:
Jay
2026-07-04 18:05:59 +00:00
committed by 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴
parent 4e475ed6b9
commit ee8903d424
2 changed files with 21 additions and 4 deletions
@@ -5,6 +5,7 @@ const directory = "C:/OpenCode/SettingsThemeSelectClose"
test("theme setting selects hide their closing dropdown before applying theme colors", async ({ page }) => {
await openSettings(page)
await expectSelectThemeColorsDoNotTransition(page)
await chooseThemeSetting(page, "Dark", "Light")
await expect(page.locator("html")).toHaveAttribute("data-color-scheme", "light")
@@ -54,6 +55,25 @@ async function expectThemeSelectClosedWithoutFlash(page: Page) {
expect(await page.evaluate(selectContentState)).toMatchObject({ visible: false })
}
async function expectSelectThemeColorsDoNotTransition(page: Page) {
const transitions = await page.locator('[data-component="select-v2"]').evaluateAll((elements) =>
elements.map((element) => {
const style = getComputedStyle(element)
return {
text: element.textContent?.trim(),
transitionProperty: style.transitionProperty,
}
}),
)
expect(
transitions.every(
(transition) =>
!transition.transitionProperty.includes("background") && !transition.transitionProperty.includes("box-shadow"),
),
JSON.stringify(transitions, null, 2),
).toBe(true)
}
function selectContentState() {
const element = document.querySelector<HTMLElement>('[data-slot="select-v2-content"]')
if (!element) return { visible: false }
+1 -4
View File
@@ -70,10 +70,7 @@
box-shadow: var(--v2-elevation-button-neutral);
flex: none;
align-self: stretch;
transition:
background 85ms ease-out,
outline-color 85ms ease-out,
box-shadow 85ms ease-out;
transition: outline-color 85ms ease-out;
}
[data-component="select-v2"][data-appearance="large"] {