Skip to content

Select: a dark multiple select shows its selection without focus - #27

Merged
bpacholek merged 1 commit into
mainfrom
bober/recomaty-panel-663
Oct 26, 2026
Merged

bpacholek merged 1 commit into
mainfrom
bober/recomaty-panel-663

Conversation

@bpacholek

Copy link
Copy Markdown
Contributor

What this changes

In the dark theme a native multiple select (<select multiple>) looked as if nothing were chosen while it had no focus. The chosen options showed up only after a click into the box. This was reported in recomaty/recomaty-panel#663. The panel first worked around it with its own override in recomaty/recomaty-panel#668. @bpacholek asked there to fix it in adminata instead and then move the panel to the new version.

Cause. .dark .adm-select option (assets/css/components/select.css) paints every option of a dark select gray-900. In a list box, that rule also covers the colour the browser gives a selected option while the box has no focus. In the browser's own stylesheet that colour is a plain declaration (Chromium: select:-internal-list-box option:checked, light-dark(#cecece, #545454)), and only the focused highlight is !important. In the light theme adminata paints no options, so the browser's grey always showed.

  • f4a2fa8e5 components/select.css: a new rule in the same @layer components block, .dark .adm-select[multiple] option:checked { background-color: revert; color: revert; }. It sits beside the rule it corrects and outranks it on specificity.
    • revert hands the selected options of a dark multiple select back to the browser, the same way the light theme always had them. Under color-scheme: dark that is the browser's own unfocused selection colour, with its hover and disabled variants.
    • Unselected options keep gray-900. A single select is not matched ([multiple]), so its options and dropdown look as before. The focused look does not change.
    • The subject is option, not a utility, so npm run css:layers is satisfied. app.css is rebuilt (one rule added). Safelist, contract and controllers snapshot are unchanged.
  • tests-adminata/Visual/select.spec.js (new): opens the product list with the Tags filter set to "New" (?filter[tags][value][]=1). That page has a native adm-select adm-select-multiple with one option selected, next to the filter's single operator select. It runs in both themes in the wide Chromium and Firefox projects and checks computed styles:
    • the selected option's background differs from every unselected option's background;
    • in the dark theme, the unselected options and every option of the single select (its selected one included) keep --color-gray-900.
    • WebKit is skipped. It paints a list box's selection over the CSS, so its computed style never shows the selection, and the bug never reached it.
  • CHANGELOG: [Unreleased] → ### Fixed: one entry.

What the browsers show (demo, Tags filter, "New" selected, box not focused)

before after
Chromium, dark "New" gray-900 like the rest grey #545454, white text (as in Chromium's own dark list boxes)
Firefox, dark "New" gray-900 like the rest Firefox's own dark-scheme selection colour (a bright cyan in headless Linux Firefox, rgb(0, 221, 255))
WebKit, dark highlighted (native painting) unchanged
light, all three browser grey unchanged

Contract

  • No template, registry key, config node, service id, Twig block or markup hook changes. The change is one CSS rule.
  • No Bootstrap/AdminLTE class, no jQuery, no inline script, no AJAX submit.
  • make check-names: clean.

Gates (local)

  • npm run build, then git diff: only src/Resources/public/app.css changes (the new rule). Safelist, contract.json and controllers snapshot are unchanged.
  • Stylelint, css:layers, Prettier, check:jquery, fixture, css:contract, size, ESLint on the new spec: OK.
  • Vitest: 281 passed.
  • In mcr.microsoft.com/playwright:v1.63.0-noble (bin/visual.sh, demo on MySQL 8.4):
    • select.spec.js: 4 passed (Chromium and Firefox, light and dark). With the old app.css the two dark cases fail, in Chromium and in Firefox (Expected: not "rgb(16, 24, 40)").
    • dashboard.spec.js, all three Chromium viewports: 84 passed. Every screenshot baseline is unchanged; no demo page shows a selected option in a multiple select.
  • Not run here: the PHPUnit suites, PHPStan, Rector and the accessibility/markup specs. No PHP or template changed. CI runs all of them.

Changelog

[Unreleased] → ### Fixed → "A multiple select showed what was chosen only while it had focus, in the dark theme (2026-10-26)".

After merge

recomaty-panel requires idct/adminata: dev-main. Bober then moves its lock to the merge commit and drops the panel's own override in recomaty/recomaty-panel#668.

Bober's change for recomaty/recomaty-panel#663, made at Bartosz's request.

🦫 ~Bober

In the dark theme a native multiple select looked as if nothing were
chosen while it had no focus (recomaty-panel#663). `.dark .adm-select
option` paints every option of a dark select gray-900, and in a list box
that rule also covered the colour the browser gives a selected option of
an unfocused box: a plain declaration in its own stylesheet (Chromium's
`select:-internal-list-box option:checked`; only the focused highlight is
!important). Chromium and Firefox both showed it; WebKit paints a list
box's selection over the CSS and never did.

- components/select.css: `.dark .adm-select[multiple] option:checked`
  reverts background and text colour to the browser's own, in
  `@layer components` beside the rule it corrects, which it outranks on
  specificity. Unselected options and every option of a single select
  keep gray-900.
- tests-adminata/Visual/select.spec.js: the product list's Tags filter
  with "New" chosen, both themes, Chromium and Firefox (wide projects):
  the selected option's computed background differs from the unselected
  ones', and in the dark theme the unselected options and the filter's
  single operator select keep gray-900. Without the new rule the dark
  case fails in both engines.
- app.css rebuilt; CHANGELOG entry under Fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bpacholek
bpacholek marked this pull request as ready for review October 26, 2026 10:35
@bpacholek
bpacholek merged commit a132bae into main Oct 26, 2026
17 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant