diff --git a/packages/starlight/components/Select.astro b/packages/starlight/components/Select.astro index 369bc3c3eda..a6ebc1b3fc0 100644 --- a/packages/starlight/components/Select.astro +++ b/packages/starlight/components/Select.astro @@ -78,6 +78,28 @@ interface Props { color: var(--sl-color-gray-1); } + /* + * Firefox on Windows renders native select option dropdowns with + * incorrect colors in dark mode — option backgrounds appear white + * and checked/hovered text is invisible. Use @supports to target + * Firefox (-moz-appearance) so other browsers are unaffected. + * Only fix option backgrounds, not the select itself, to preserve + * transparent backgrounds on pages like the homepage. + * See: https://github.com/withastro/starlight/issues/3426 + */ + @supports (-moz-appearance: none) { + :global([data-theme='dark']) select option, + :global([data-theme='dark']) select option:checked { + background-color: var(--sl-color-bg-nav); + color: var(--sl-color-text); + } + + :global([data-theme='dark']) select option:hover { + background-color: var(--sl-color-accent-high); + color: var(--sl-color-text-invert); + } + } + @media (min-width: 50rem) { select { font-size: var(--sl-text-sm);