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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement keyboard and focus management #3897
Implement keyboard and focus management #3897
Changes from all commits
a10f3ab
7302396
17a9f95
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General believe, i think, is that
outline
s are good for accessibility. Is there any reason you don't like it here? I think replacing it with border is fine, but sometimes there are other factors. For instance, if UX asks to add an extra pixel to the outline, very little needs to change, vs makingborder
thicker could cause relayout. But other than that, this is not critical.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm am open to using either
outline
orborder
, no preference. However, the UX called for a specific design with a specific border and I wasn't able to replicate it usingoutline
only. For a11y purposes I think we're safe as long as we do something else to provide highlight.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me to the precise place in figma with that style. I just want to confirm it once so we don't have to stumble on this each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's shown in the section about deleting a page from the carousel:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. We'd just need to always reserve a border and only manipulate the
border-color
fromtransparent
to focused color.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use
React.forwardRef
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should also use forwardRef, yes (which allows me to use
ref={}
in the parent component), but I still need some way to merge the two refs, when needing the ref both in the component itself and in a parent component. It can't be done any other way, unfortunately.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single forwarded ref usually does the trick for me, but sure, if there's need, let's keep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify: this shouldn't be
new MouseTrap
, should it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mousetrap doesn't use
new
in their docs, but I do see that WP does in their implementation, that I was inspired by.I feel that I remember seeing something about
new
syntax being discouraged, but I can't find it again.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs say:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don't really know what the difference is here (that is, the actual effect of doing either). The current implementation works, but maybe not efficiently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, but to clarify: what does
Tab
do inside the NavigableGroup?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pressing tab navigates between focusable elements using browser-native implementation. Just like enter clicks the currently focused element - this is also using browser-native behaviour. I believe that's excellent for a11y.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think that's good. In some systems tab jumps between bigger blocks and arrows are used to navigate within the block. But I think for now a simple way is better. This might pop up for e.g. gallery, where there might be unlimited set of things to tab over, which could make tab harder to use to navigate to other elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the tablist implementation at https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html and the one I built for WordPress core (click on share icon on https://wordpress.org/news/2019/12/wordpress-5-3-1-security-and-maintenance-release/embed/), pressing tab jumps to the current tab's content, not to the next tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for those links - very helpful!
Those definitely are different ways of implementing this. The inactive tabs don't participate in tab order at all it seems (
tabindex="-1"
) - only the active tab and the tab content. tab and shift+tab then navigate between the active tab and the tab content in the regular way based off document order.And they have an example of both automatic and manual tab switching. Very interesting approaches - I will read up on those!