Repository navigation
fix(ui): theme select fields and stop their jump on focus - #48
Merged
Merged
Conversation
The select fields opened the browser's own option list. In dark mode that list is white, its options are barely readable and the selection is the OS blue, so it clashed with the theme. MdSelect now uses a select-only combobox with an MD3 menu drawn in the body. The menu takes the surface-container and primary roles, opens above the field when there is no room below, and scrolls when neither side has room. The keyboard works as on a native select: arrows, Home, End, type-ahead, Enter, Space, Escape and Tab. The combobox carries the ARIA attributes for the listbox pattern. The native select stays in the DOM, hidden, as the form value. v-model, form names and the call sites are unchanged.
A focused select showed two colours at once. The field's outline was the theme primary, but @tailwindcss/forms draws a blue outer ring on a focused select, so the native select also showed a blue-violet line, and the floating label stayed pink. The field is now a combobox, and the focus colour is primary for the outline, the floating label and the trailing icon. The outline is a 1px border with a 1px inset shadow, so focus never grows the box or moves the label. Invalid fields keep the error role, focused or not, and disabled fields take no focus colour. Tests lock in the focus classes, the 1px border and the error and disabled states.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The select fields in the MD3 dashboard had three visible problems in dark mode: the open option list was the browser's own white popup with barely readable options and an OS-blue selection, a focused field showed a purple outline next to a pink label, and the field appeared to jump on focus.
Cause:
MdSelectwrapped a native<select>. The browser drew its own option list, and@tailwindcss/formsdraws a blue outer ring on a focused<select>, so the outline and the label disagreed.Fix:
MdSelectis now a select-only combobox with an MD3 menu drawn in the body. The menu uses the surface-container and primary roles, opens above the field when there is no room below, and follows the keyboard as a native select does (arrows, Home, End, type-ahead, Enter, Space, Escape, Tab). The focus colour is primary for the outline, the floating label and the trailing icon. The outline is a 1px border plus a 1px inset shadow, so focus never moves the field. Invalid fields keep the error role.All call sites (search sort and order, audit action, maintenance dialogs, settings forms, repository wizard, the JSON-forms enum and one-of renderers) use
MdSelect, so they change without edits. v-model, props and events are unchanged. A visually hidden native<select>stays in the DOM as the form value, so existing code that reads the select by id or name keeps working.Type of change
fix- bug fixfeat- new featurerefactor- internal change without behaviour changeperf- performance improvementdocs- documentation onlytest- tests onlybuild/ci/chore- tooling, dependencies, pipelinesHow was tested
Frontend only (
reposilite-frontend/). Gradle was not run.npx vitest runonMdSelect.test.js(42 tests: keyboard, v-model, ARIA, menu placement, focus classes, error and disabled states), plus the 19 test files of the components that renderMdSelect(538 tests in total) with--maxWorkers=2, all green.npm run build: passes.eslinton the two changed files: clean.sorttoartifactId, updates the URL and keeps focus on the field.Checklist
CLAUDE.md./gradlew buildpasses locally (not run: no backend change)