Skip to content
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 top-level burger menu keyboard navigation #12876

Merged
merged 3 commits into from
Dec 18, 2024
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
10 changes: 9 additions & 1 deletion shell/assets/styles/base/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,16 @@
}
}

// -------------------------------------------------------------------------------------------------
// Focus styles

@mixin form-focus {
// Focus for form like elements (not to be confused with basic :focus style)
outline: none;
border-color: var(--outline);
}
}

@mixin focus-outline {
// Focus for form like elements (not to be confused with basic :focus style)
outline: 2px solid var(--primary-keyboard-focus);
}
2 changes: 2 additions & 0 deletions shell/assets/styles/themes/_light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $disabled : $medium;
$primary : #3D98D3;
$secondary : $darker;
$link : #3D98D3;
$keyboard-focus : #3300ff;

// Status colors
$success : #5D995D;
Expand Down Expand Up @@ -53,6 +54,7 @@ BODY, .theme-light {
--primary-border : #{$primary};
--primary-banner-bg : #{rgba($primary, 0.15)};
--primary-light-bg : #{rgba($primary, 0.05)};
--primary-keyboard-focus : #{$keyboard-focus};


.text-primary {
Expand Down
1 change: 1 addition & 0 deletions shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ locale:
none: (None)

nav:
expandCollapseAppBar: Expand/Collapse the Application Bar
harvesterDashboard: Harvester Dashboard
backToRancher: Cluster Manager
tools: Tools
Expand Down
14 changes: 14 additions & 0 deletions shell/components/nav/TopLevelMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,12 @@ export default {
<div class="title">
<div
data-testid="top-level-menu"
:aria-label="t('nav.expandCollapseAppBar')"
role="button"
tabindex="0"
class="menu"
@keyup.enter="toggle()"
@keyup.space="toggle()"
@click="toggle()"
>
<svg
Expand Down Expand Up @@ -972,6 +977,15 @@ export default {
align-items: center;
justify-content: center;

&:focus-visible {
outline: none;

.menu-icon {
@include focus-outline;
outline-offset: 4px; // Ensure there is space around the menu icon for the focus indication
}
}

.menu-icon {
width: 25px;
height: 25px;
Expand Down
Loading