-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiSelectable] Fix focus ring on non-searchable listboxes #6637
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,22 +3,31 @@ | |
| // This re-uses the same faux focus ring mixin, but adjusts the outline instead | ||
| // @param {size} Old param from default theme that won't be used, so it should always be `null` | ||
| // @param {offset} Accepts a specific number or 'inner' or 'outer' to adjust outline position | ||
| @mixin euiFocusRing($size: null, $offset: false) { | ||
| // @param {includeFocusVisible} Allows turning off :not:focus-visible selector (which can interfere with some manual usages) | ||
| @mixin euiFocusRing($size: null, $offset: false, $focusVisibleSelectors: true) { | ||
| // Safari & Firefox | ||
| outline: $euiFocusRingSize solid currentColor; | ||
|
|
||
| // Chrome | ||
| &:focus-visible { | ||
| outline-style: auto; | ||
| } | ||
| @if ($focusVisibleSelectors) { | ||
| // Chrome | ||
| &:focus-visible { | ||
| outline-style: auto; | ||
| } | ||
|
|
||
| &:not(:focus-visible) { | ||
| outline: none; | ||
| &:not(:focus-visible) { | ||
| outline: none; | ||
| } | ||
| } @else { | ||
| outline-style: auto; | ||
|
Comment on lines
+11
to
+21
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This extra the However, the |
||
| } | ||
|
|
||
| // Adjusting position with offset | ||
| @if (type-of($offset) == number) { | ||
| outline-offset: #{$offset}px; | ||
| @if (unitless($offset)) { | ||
| outline-offset: #{$offset}px; | ||
| } @else { | ||
| outline-offset: #{$offset}; | ||
| } | ||
|
Comment on lines
+26
to
+30
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } @else if ($offset == 'inner') { | ||
| outline-offset: -$euiFocusRingSize; | ||
| } @else if ($offset == 'outer') { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| **Bug fixes** | ||
|
|
||
| - Fixed visual listbox focus ring bug on non-searchable `EuiSelectable`s |

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.
See WICG/focus-visible#151 for more discussion -
:focus-withinunfortunately grabs all focus including mouse clicks, when we likely only want keyboard focus.:focus-within-visiblewas discarded by WICG as a spec, with:has()being the recommended way forward.