You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.
Using a mouse, click on the label for a checkbox (not the checkbox itself)
Observe a border appear around the wider filter.
Expected behaviour:
No border should appear
Actual behaviour:
Border appears.
Reproduces how often:
Always
Additional Information
After a little debugging, the issue seems to be because the filter is given tabindex=-1 so that it can be focused when it's opened as a popover on the mobile view. This stackoverflow issue covers a similar scenario.
Essentially, when a user clicks on the label, focus moves away from wherever it was, and up to the next focusable thing - which in this case is the component container. When the mouse is released, the checkbox itself receives focus.
One solution is to make the labels focusable, and to remove their focus styles - this would 'appear' to work - though feels a bit hacky.
On my service I think I may disable focus styles entirely on the filter component - at least on the desktop view. Users can't tab in to the component, so showing visible focus doesn't seem to be essential.
The text was updated successfully, but these errors were encountered:
I came up with a fix - we add a second focusable element inside of the filter, and suppress the styles on it. When checkbox labels are clicked, the second element is what gets focus - but it's transparent to the user. See my pr.
Description
My service is using the filter a list pattern.
If a user clicks on a label for a checkbox, a border is drawn around the filter component whilst their mouse is down.
Steps to Reproduce
Expected behaviour:
No border should appear
Actual behaviour:
Border appears.
Reproduces how often:
Always
Additional Information
After a little debugging, the issue seems to be because the filter is given
tabindex=-1
so that it can be focused when it's opened as a popover on the mobile view. This stackoverflow issue covers a similar scenario.Essentially, when a user clicks on the label, focus moves away from wherever it was, and up to the next focusable thing - which in this case is the component container. When the mouse is released, the checkbox itself receives focus.
One solution is to make the labels focusable, and to remove their focus styles - this would 'appear' to work - though feels a bit hacky.
On my service I think I may disable focus styles entirely on the filter component - at least on the desktop view. Users can't tab in to the component, so showing visible focus doesn't seem to be essential.
The text was updated successfully, but these errors were encountered: