-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Lens] (Accessibility) focus on adding/removing layers #84900
[Lens] (Accessibility) focus on adding/removing layers #84900
Conversation
f35a289
to
bedbfc4
Compare
12f62fd
to
4219efd
Compare
Pinging @elastic/kibana-app (Team:KibanaApp) |
4219efd
to
9082efc
Compare
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.
Code looks ok, just a minor comment. Tested locally on Chrome and Firefox and it works as described in the PR description.
TBH I'm not 100% sure about the behaviour here, I understand the focus should go to the first tabbable element, but see that tooltip show up makes me wonder as user I did something wrong.
But if @myasonik is ok then I won't object.
To clarify my concerns are:
- while it makes sense to put the focus on the first tabbable element, having that tooltip show up confuses me a bit. It would be great to either have the focus without the tooltip or set the focus to the datasource selection maybe?
- when I have multiple layers and delete it, I would expect the focus to move to the N-1th layer rather than scroll all the way up.
x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx
Outdated
Show resolved
Hide resolved
I agree with both points @dej611 – it's quite unfortunate that the first focusable element in the layer is a tooltip. So far I just implemented it according it to the issue description, but this PR can be an intro to discussion. |
Awesome work @mbondyra! I understand the annoyance with the tooltip so let's implement something slightly different that still achieves the goal. For where to place focusInstead of moving focus to the first tabbable element, you can also move focus to the layer panel overall. You'll need to add TL:DR some final-ish pseudocode of <section tabIndex={-1} panelRef={ref}>
{/* the contents of layer panel today in here */}
</section> For delete@dej611 said:
If y'all agree this would be the more common need, this would also be appropriate. Feel free to move focus to wherever you feel is the most expected next thing the person will need to interact with. |
Thanks @myasonik! I've updated the PR, please take a look at the description above before checking the code :) |
|
||
props.updateAll(datasourceId, newState, nextVisState); | ||
}, | ||
<section tabIndex={-1} ref={setLayerRefMemoized}> |
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 am surprised that git analyzed this file this way. Line 140 is the only changed line in the whole return
statement (I added the section
container, so plus its closing).
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.
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.
Nice!!! Thanks for the tip, I forgot about this!
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.
CSS changes looks good.
Nice enhancement!
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.
LGTM!
If you move the lnsLayerPanel
class to the <section>
, you can add these styles to it to remove the focus ring for mouse clicks and it doesn't break anything else:
.lnsLayerPanel {
margin-bottom: $euiSizeS;
// disable focus ring for mouse clicks, leave it for keyboard users
&:focus:not(:focus-visible) {
animation: none !important;
}
}
(Tested with old and new theme. Won't work if the browser doesn't support focus-visible
but the fallback is it just always shows the focus ring so it's not bad.)
@ryankeairns Is that scss change fine?
@elasticmachine merge upstream |
Hey @myasonik does that mean we don't want to show focus ring at all, both for mouse and keyboard users when user removes/adds a layer? I am ok with it, but just making sure because that's how it works for Chrome. For FF and Safari it doesn't give any effect. |
💚 Build SucceededMetrics [docs]Async chunks
Distributable file count
History
To update your PR or re-run it, just comment with: |
Yep, looks good. Thanks for walking me through the example. |
@mbondyra Just tested this locally and everything seems to work as expected for me |
Summary
Fixes #83595
When layer is reset (so there's just one) the focus goes to the layer.
When layer is removed, the focus goes to the layer before it.
When layer is added, the focus goes to the added layer.
Adding tabIndex={-1} caused the side effect - now when we click on the layer, it gets selected. I am not sure if it's a problem though