Repository navigation
feat(ui): animate segmented control with solid-motion and fix button hit-testing - #53825
Merged
Merged
Conversation
3 of 6 tasks
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.
Why
SegmentedControlswitched active segments statically without an indicator transition, did not brighten inactive segment labels on hover, and allowed child label nodes to intercept pointer hit-testing and text selection. Additionally,button.css,icon-button.css, andtabs-current.cssdefined an unscoped universal*rule that leaked font-smoothing andtext-rendering: geometricPrecisionacross the entire document, andButtonchild elements could split hit-testing from the<button>.What Changes
SegmentedControl): Renders a<motion.span data-slot="segmented-control-v2-indicator" aria-hidden="true" />driven by@kitlangton/solid-motion({ type: "spring", visualDuration: 0.15, bounce: 0 }by default, configurable viatransition), jumping immediately on initial mount, resize, orprefers-reduced-motionand spring-animating between active segments.:not([data-ready])active-item background and border-shadow styling before layout measurement completes.:hover:not(:disabled):not([data-pressed])), disables text selection on the control and items, and setspointer-events: noneon[data-slot="segmented-control-v2-item-label"].[data-component="button-v2"] > * { pointer-events: none; }and scopes-webkit-font-smoothing: antialiasedand-moz-osx-font-smoothing: grayscaleto[data-component="button-v2"],[data-component="icon-button-v2"], and[data-component="tabs-v2"]instead of universal*.Scope
Covers
@opencode/uiSegmentedControl(SegmentedControlV2/SegmentedControlItemV2aliases included),button.css,icon-button.css, andtabs-current.css.Verification
bun run --cwd packages/ui typecheck bun run --cwd packages/ui test bun run --cwd packages/ui build bun run lint:changedpackages/uitypecheck (tsgo --noEmit), build (tsc -p tsconfig.build.json), and unit tests (135 passing across 8 files, includingsegmented-control.test.ts) pass.bun run check(repo-wideoxlint,ast-grep,sdk-docs, andturbo typecheckacross 36 packages) passed on push.