Repository navigation
fix(registry): show the elastic slider focus ring only for keyboard focus - #54
Merged
Merged
Conversation
…ocus Pressing or dragging the ruler focuses the hidden range input so the keys keep working, but that programmatic focus matched :focus-visible and drew the ring on every mouse drag. The ring now follows a keyboardFocus state: on for Tab focus or any key press, off on pointer down and blur. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What
The focus ring around the Elastic Slider's ruler showed up on every mouse press and drag. It should only show for keyboard focus.
Why it happened. Pressing the ruler calls
focus()on the hidden<input type="range">so the arrow keys keep working after a drag. Browsers treat that programmatic focus as:focus-visible, so the ring drew on mouse use too.The fix. The ring now follows a
keyboardFocusstate instead ofpeer-focus-visible:Focus still moves to the input on press, so the keyboard keeps working straight after a drag.
Tests
I checked the mouse test catches the bug: with the pointer check removed, it fails. The
PointerEventpolyfill moved to file level so the pointer tests send a realclientX.Checks
pnpm registry:buildpassespnpm typecheckpasses