Manage the active item via focus instead constant value#81
Closed
mu-hun wants to merge 3 commits intoCaptainCodeman:masterfrom
Closed
Manage the active item via focus instead constant value#81mu-hun wants to merge 3 commits intoCaptainCodeman:masterfrom
mu-hun wants to merge 3 commits intoCaptainCodeman:masterfrom
Conversation
mu-hun
commented
Dec 17, 2023
| const item = state.items[active] | ||
| if (item) { | ||
| item.node.scrollIntoView({ block: 'nearest' }) | ||
| item.node.focus() |
Author
There was a problem hiding this comment.
I removed the scrollIntoView call line because the focus method also functions as a scroll.
Owner
|
Thanks for this. Yeah, I generally think styling based on aria attributes is always better as it helps make them a first-class feature more than an add-on. The original idea was to try to have parity with the official headless lib when it came to the actual HTML & CSS. The |
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.
Manage the active item via focus
Most of the AGP documentation, including examples you to manage the keyboard & mouse active item as the focus.
I suggest to change styling at the CSS selectors level if possible, rather than manipulating the styles on the JS side in the examples.
Updated example list
Unfortunately, I made it a Draft PR because there is problem at keyboard interaction between Combobox items.