Skip to content

[AX] Color scheme toggle keyboard navigation should follow radio buttons standards #401

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 3 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/ColorSchemeToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
aria-label="Select a color scheme preference"
class="color-scheme-toggle"
role="radiogroup"
tabindex="0"
>
<label
v-for="option in options"
Expand Down Expand Up @@ -85,6 +84,12 @@ input {
appearance: none;
}

label {
@include on-keyboard-focus-within() {
@include focus-outline();
}
}

.text {
border: 1px solid transparent;
border-radius: var(--toggle-border-radius-inner, 2px);
Expand Down
8 changes: 3 additions & 5 deletions src/components/Filter/FilterInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,9 @@ $input-height: rem(28px);
border-bottom-left-radius: $small-border-radius - 1;
border-bottom-right-radius: $small-border-radius - 1;

.fromkeyboard & {
&:focus {
outline: none;
box-shadow: 0 0 0 5px var(--color-focus-color);
}
@include on-keyboard-focus() {
outline: none;
box-shadow: 0 0 0 5px var(--color-focus-color);
}
}

Expand Down
16 changes: 7 additions & 9 deletions src/components/Navigator/NavigatorCardItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,13 @@ $nesting-spacing: $card-horizontal-spacing + $card-horizontal-spacing-small;
display: flex;
align-items: center;

.fromkeyboard & {
&:focus-within {
margin: $card-horizontal-spacing-small;
height: $item-height - 10px;
@include focus-outline();

.depth-spacer {
margin-left: -$card-horizontal-spacing-small;
}
@include on-keyboard-focus-within() {
margin: $card-horizontal-spacing-small;
height: $item-height - 10px;
@include focus-outline();

.depth-spacer {
margin-left: -$card-horizontal-spacing-small;
}
}
}
Expand Down
15 changes: 13 additions & 2 deletions src/styles/core/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
line-height: $line-height;
clip-path: unset;
}
}
};

////
/// Apply styling only when focused via the keyboard.
Expand All @@ -78,7 +78,18 @@
@content
}
}
}
};

////
/// Apply styling only when focused via the keyboard in an element inside.
////
@mixin on-keyboard-focus-within() {
.fromkeyboard & {
&:focus-within {
@content
}
}
};

////
/// Replaces the outline effect when an element is in focus, with a box shadow effect.
Expand Down