Skip to content

Commit

Permalink
Fix top-level burger menu keyboard navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
nwmac committed Dec 12, 2024
1 parent 1c540a8 commit 976e342
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
12 changes: 10 additions & 2 deletions 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);
}
border-color: var(--primary-focus);
}

@mixin focus-outline {
// Focus for form like elements (not to be confused with basic :focus style)
outline: 2px solid var(--primary-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;
$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-focus : #{$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

0 comments on commit 976e342

Please sign in to comment.