Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/select-forced-colors-arrow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Select: Use the appropriate system color for enabled and disabled dropdown arrows in forced-colors mode.
30 changes: 30 additions & 0 deletions e2e/components/Select.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,36 @@ const stories = [
] as const

test.describe('Select', () => {
for (const disabled of [false, true]) {
test(`arrow uses the ${disabled ? 'disabled' : 'enabled'} system color in forced colors @vrt`, async ({page}) => {
await page.emulateMedia({forcedColors: 'active'})
await visit(page, {
id: disabled ? 'components-select-features--disabled' : 'components-select--default',
})

const select = page.getByRole('combobox')
if (disabled) {
await expect(select).toBeDisabled()
} else {
await expect(select).toBeEnabled()
}

const expectedFill = await page.evaluate(
color => {
const reference = document.createElement('span')
reference.style.color = color
document.body.append(reference)
const result = getComputedStyle(reference).color
reference.remove()
return result
},
disabled ? 'GrayText' : 'FieldText',
)

await expect(select.locator('..').locator('svg')).toHaveCSS('fill', expectedFill)
})
}

for (const story of stories) {
test.describe(story.title, () => {
for (const theme of themes) {
Expand Down
8 changes: 3 additions & 5 deletions packages/react/src/Select/Select.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@

@media screen and (forced-colors: active) {
svg {
/* stylelint-disable-next-line declaration-property-value-no-unknown */
fill: 'FieldText';
fill: FieldText;
}
}
}

.Disabled {
@media screen and (forced-colors: active) {
svg {
/* stylelint-disable-next-line declaration-property-value-no-unknown */
fill: 'GrayText';
+ .ArrowIndicator {
fill: GrayText;
}
}
}
Expand Down
Loading