-
Notifications
You must be signed in to change notification settings - Fork 3
Fix keyboard focus indication (CMEM-7512) #380
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8093180
add fallback for visual focus indication on keyboard navigation
haschek be46a58
fix focus indicator on heade buttons
haschek 7d523a4
remove debug comment
haschek c281fab
force at east 2px visible focus outline
haschek 603a952
fix tooltipl re-focus after swapping the placeholder, it now works in…
haschek 94ed684
add accessibility outline properties to the custom properties overview
haschek c677ce5
use outlines for input elements to improve accessibility
haschek 3063efe
update changelog
haschek d39be04
fix event dispatching and extend tests on it for focus by keyboard na…
haschek 41a9050
hide focus on traps
haschek 39eebf5
Merge branch 'develop' into bugfix/keyboardFocusIndication-CMEM-7512
haschek 71796e0
move comment to top of rules
haschek 8dcde88
fix focus styles for Link component
haschek e4f22a2
fix focus styles for Link component, make mixin available for cases t…
haschek d9e4e4b
change outline color for contrast factor
haschek ab7779a
fix styles
haschek c0ea5e5
use static and animated focus class
haschek 5d7801c
use class prefix
haschek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| .#{$prefix}--assistive-text, | ||
| .#{$prefix}--visually-hidden { | ||
| /* | ||
| TODO: move to better place, originally from ~@carbon/styles/scss/css--helpers | ||
| but we cannot use it directly because of other included rules there. | ||
| */ | ||
| position: absolute; | ||
| visibility: inherit; | ||
| width: 1px; | ||
| height: 1px; | ||
| padding: 0; | ||
| margin: -1px; | ||
| overflow: hidden; | ||
| white-space: nowrap; | ||
| border: 0; | ||
| clip: rect(0, 0, 0, 0); | ||
| } | ||
|
|
||
| /* | ||
| default focus indicator | ||
| */ | ||
|
|
||
| :root { | ||
| --#{$eccgui}-a11y-outline-color: #{eccgui-color-var("layout", "magenta", "900")}; | ||
| --#{$eccgui}-a11y-outline-style: solid; | ||
| --#{$eccgui}-a11y-outline-width: #{0.25 * $eccgui-size-block-whitespace}; | ||
|
|
||
| // shift outline min 2px inside element to have a minimum 2px outline even with hidden overflow | ||
| --#{$eccgui}-a11y-outline-offset: min(calc(var(--#{$eccgui}-a11y-outline-width) * -0.5), -2px); | ||
| } | ||
|
|
||
| @keyframes outline-bounce { | ||
| 0% { | ||
| outline-width: calc(var(--#{$eccgui}-a11y-outline-width) * 0.5); | ||
| outline-color: var(--#{$eccgui}-a11y-outline-color); | ||
| outline-offset: var(--#{$eccgui}-a11y-outline-offset); | ||
| } | ||
|
|
||
| 33.3% { | ||
| outline-color: var(--#{$eccgui}-a11y-outline-color); | ||
| outline-offset: calc(var(--#{$eccgui}-a11y-outline-width)); | ||
| } | ||
|
|
||
| 66.6% { | ||
| outline-color: currentcolor; | ||
| outline-offset: calc(var(--#{$eccgui}-a11y-outline-width) * -2); | ||
| } | ||
|
|
||
| 100% { | ||
| outline-width: var(--#{$eccgui}-a11y-outline-width); | ||
| outline-color: var(--#{$eccgui}-a11y-outline-color); | ||
| outline-offset: var(--#{$eccgui}-a11y-outline-offset); | ||
| } | ||
| } | ||
|
|
||
| @mixin focus-by-keyboard { | ||
| // strong visual focus indication for keyboard devices | ||
|
|
||
| outline: var(--#{$eccgui}-a11y-outline-color) var(--#{$eccgui}-a11y-outline-style) | ||
| var(--#{$eccgui}-a11y-outline-width); | ||
| outline-offset: var(--#{$eccgui}-a11y-outline-offset); | ||
|
|
||
| @media (prefers-reduced-motion: no-preference) { | ||
| animation: outline-bounce 0.5s; | ||
| } | ||
| } | ||
|
|
||
| .focus-by-keyboard { | ||
| @include focus-by-keyboard; | ||
| } | ||
|
|
||
| @mixin focus-by-pointer { | ||
| // limited visual focus indication for pointer devices | ||
|
|
||
| outline: transparent none 0; | ||
| outline-offset: 0; | ||
| } | ||
|
|
||
| .focus-by-pointer { | ||
| @include focus-by-pointer; | ||
| } | ||
|
|
||
| *[tabindex]:not([tabindex^="-"]):focus-visible, | ||
| :focus-visible { | ||
| @extend .focus-by-keyboard; | ||
| } | ||
|
|
||
| input:focus:not(:focus-visible), | ||
| textarea:focus:not(:focus-visible), | ||
| :focus:not(:focus-visible) { | ||
| @extend .focus-by-pointer; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.