Repository navigation
refactor: dedupe Settings segmented fieldsets into OptionGroup - #693
Merged
Merged
Conversation
The eight segmented option fieldsets in SettingsView were hand-rolled
copies of the same fieldset > legend > div.segmented > button[aria-pressed]
structure. Replace them with a single OptionGroup component.
Adds to controls.tsx:
- OptionGroup, generic over string | number option values, with an optional
columns modifier and a children slot for the trailing note that the
overlay-visibility fieldset renders inside its fieldset
- secondsOptions, which builds the {value / 1000}s labels shared by the
movement, scroll, key and dwell interval groups
- overlayVisibilityOptions and overlaySizeOptions
The DOM is byte-identical. Verified empirically by dumping the rendered
Settings view innerHTML on the parent commit and on this one and diffing:
identical at default settings, and identical again with every feature
toggle enabled and non-default selections across all eight groups.
The pointer-speed fieldset is left alone; its buttons carry per-option
aria-labels and it renders extra content, so it is not the same structure.
SettingsView.tsx: 82 -> 70 lines. Tests unchanged, 75 passing.
Refs #684
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 8, 2026
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.
Closes #684. Replaces #692, which GitHub auto-closed when its base branch
refactor/settings-module-683was deleted on merge of #691. Same branch, rebased ontomain; the code is unchanged and the review on #692 found no findings.The eight segmented option fieldsets in
SettingsViewwere hand-rolled copies of the samefieldset > legend > div.segmented > button[aria-pressed]structure. This replaces them with oneOptionGroup.Added to
controls.tsxOptionGroup— generic overstring | numberoption values, with an optionalcolumnsmodifier (three/four/five, omitted entirely for the one group that has no column class) and achildrenslot for the trailing note that the overlay-visibility fieldset renders inside itsfieldset.secondsOptions— builds the{value / 1000}slabels shared by the movement, scroll, key and dwell interval groups. Returns the label as a fragment so the button keeps its two text nodes rather than collapsing to one.overlayVisibilityOptions,overlaySizeOptions.SettingsView.tsx: 82 → 70 lines.The pointer-speed fieldset is deliberately untouched
Its buttons carry per-option
aria-labels and it renders an exact-speed select plus a movement-values readout, so it is not the same structure. Folding it in would have meant changing DOM.Byte-identical DOM — verified, not assumed
Rather than relying on the tests passing, the rendered Settings view
innerHTMLwas dumped on the parent commit and on this one and diffed:The non-default cases matter because the default dump leaves
aria-pressedanddisableduniform. Every button was also clicked at both commits to confirm eachonChangestill writes the sameAppSettingskey. The dump harness was temporary and is not committed.Validation
Re-run after the rebase onto
main:npm run lintnpm testnpm run buildcargo fmt --checkcargo clippy --all-targets -- -D warningscargo testNo Rust files are touched; the Rust gates are run per
AGENTS.md.Review note carried over from #692
The review suggested letting
Tinfer fromoptionsinstead of passing explicit type arguments, so that a future edit attaching the wrong option list would fail to compile. That was tested: with inference enabled, deliberately wiringdwellDelayOptionsinto the Scroll interval group still compiles clean, because all four interval settings are plainnumber. The suggestion does not deliver the protection described for the swap that is actually plausible here, so the explicit form was kept.🤖 Generated with Claude Code