Repository navigation
refactor(core): tidy ComplexSelector trigger focus ring and icon slot - #5114
Merged
Merged
Conversation
Follow-up nits from the #4769 review: - Both variant branches applied focusOutlineStyles.focusWithin, so the condition was always true; apply it unconditionally and restore the note explaining why the ring is :has(:focus-visible). - Guard the start icon with isRenderable, the shared slot-content check.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsComplexSelector (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
marked this pull request as ready for review
August 17, 2026 01:34
This branch was successfully deployed
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.
Follow-up nits from the review on #4769, split out as agreed at merge time.
This is a readability refactor, not a fix — it is behavior-preserving. Both edits remove a condition that never did any work. Nothing about what the component renders, or when, changes. There is no changeset for that reason.
Focus ring.
variant === 'input'andvariant === 'ghost'both appliedfocusOutlineStyles.focusWithin, andComplexSelectorVariantis exactly those two — so the condition was always true. Applied unconditionally, and restored the note (dropped in #4769) explaining that the ring lives on the wrapper but must stay a keyboard ring, i.e.:has(:focus-visible)rather than:focus-within.styles.triggerGhostsets nooutline*longhands, so the reordering does not change what wins.Start icon. Guarded with the shared
isRenderablehelper instead of raw truthiness.isRenderabletakes aReactNodeandstartIconisReactNode | IconType, so the check is on the resolved slot node — cast-free, and no change to the publicisRenderablesignature.Behavior verification
The rendered DOM was compared before and after across the whole
startIconinput space — 15 inputs, identical DOM on every one. That includes each way the slot can be empty, which is where a truthiness-to-isRenderableswap would show up if it were going to:undefined,null,false,0,'', an empty fragment, an empty array, and a component that returnsnull.0is the interesting one, and it is unchanged and out of scope:startIcon={0}paints a literal "0" in the trigger, both before and after. Before,0 && renderIconSlot(0)evaluated to0; nowrenderIconSlot(0)returns0andisRenderable(0)istrue, so React renders the same text node. That is a pre-existing wart in the slot contract, not something this PR introduces or repairs — fixing it means deciding what anisRenderableslot should do with a stray number, which belongs in its own change.Test plan
mainin;pnpm vitest run packages/core/src/ComplexSelector packages/core/src/Selector packages/core/src/MultiSelector— 238 passedtsc --noEmitonpackages/core,eslinton the component — clean