-
Notifications
You must be signed in to change notification settings - Fork 206
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
fix(picker): added a custom class to make :focus-visible
styles consistent across all browsers
#4724
Conversation
Lighthouse scores
What is this?Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on Transfer Size
Request Count
|
Pull Request Test Coverage Report for Build 10844986518Details
💛 - Coveralls |
7f09c89
to
8c1dfeb
Compare
Tachometer resultsChromeaction-bar permalinkbasic-test
action-button permalinkbasic-test
action-group permalinkbasic-test
action-menu permalinktest-basic
test-directive permalink
test-lazy permalink
test-open-close-directive permalink
test-open-close permalink
breadcrumbs permalinkbasic-test
combobox permalinkbasic-test
light-dom-test permalink
contextual-help permalinkbasic-test
menu permalinktest-basic
overlay permalinkbasic-test
directive-test permalink
element-test permalink
lazy-test permalink
picker permalinkbasic-test
popover permalinktest-basic
split-button permalinkbasic-test
tooltip permalinktest-basic
test-directive permalink
test-element permalink
test-lazy permalink
truncated permalinkbasic-test
Firefoxaction-bar permalinkbasic-test
action-button permalinkbasic-test
action-group permalinkbasic-test
action-menu permalinktest-basic
test-directive permalink
test-lazy permalink
test-open-close-directive permalink
test-open-close permalink
breadcrumbs permalinkbasic-test
combobox permalinkbasic-test
light-dom-test permalink
contextual-help permalinkbasic-test
menu permalinktest-basic
overlay permalinkbasic-test
directive-test permalink
element-test permalink
lazy-test permalink
picker permalinkbasic-test
popover permalinktest-basic
split-button permalinkbasic-test
tooltip permalinktest-basic
test-directive permalink
test-element permalink
test-lazy permalink
truncated permalinkbasic-test
|
// if the focus comes from a closing the menu, we need to make sure to | ||
// unset the :focus-visible state to avoid the focus ring on safari mobile | ||
if (isWebKit() && !this.open) { | ||
this.target.blur(); |
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.
Are we sure that .blur()
is the desired approach here? From my understanding, using .blur() will remove focus from the element entirely, but our intention seems to be to keep the element focused while only removing the visual indication (the focus ring). Or how does it work in the other browsers?
Can we check where the focus goes with this implementation? Does it impact keyboard navigation?
:focus-visible
styles consistent across all browsers
8ac0d19
to
676b986
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.
This solution is actually ingenious! 😄
Do you think we could try and cover this with a simple test? I believe we can mock the isWebKit
and check the computed style of the ::after
pseudo element. Let me know if you want to sync on this 👍
Missed on the lint change that doesnt need to be addressed here in this PR
Something on this front. const isWebKitMacOS = isWebKit() && detectOS() === 'Mac OS'; |
Note: I have to add tests to this and also make sure that it works for picker and other related components (if any) |
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.
Looks good!
Description
Added a custom
remove-focus-ring-safari-hack
class that gets applied when the picker (that is opened using a mouse click) closes after making a selection in a mobile environment using webkit.This class unsets the focus-ring properties that we apply for the
:focus-visible
pseudo class.This is needed so that we don't get focus-ring styles on making a selection in an action-menu in a IOS device.
Related issue(s)
Motivation and context
Blue Focus Ring should not appear on the action-menu and picker on opening and closing in IOS mobile devices.
How has this been tested?
On IOS mobile devices
Test 1 -
Test 2 -
Test 3 -
On All Desktop Devices
Test 1 -
Test 2 -
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.