Skip to content

Commit 7c8fa30

Browse files
techfgdelucistrueberrylessSnowDingo
authored
Improve visual styling of mobile menu toggle when menu is open (#2727)
Co-authored-by: Chris Swithinbank <[email protected]> Co-authored-by: trueberryless <[email protected]> Co-authored-by: SnowDingo <[email protected]>
1 parent 6a56d1b commit 7c8fa30

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/small-days-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/starlight': minor
3+
---
4+
5+
Updates mobile menu toggle styles to display a close icon while the menu is open

packages/starlight/components/MobileMenuToggle.astro

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import Icon from '../user-components/Icon.astro';
99
aria-controls="starlight__sidebar"
1010
class="sl-flex md:sl-hidden"
1111
>
12-
<Icon name="bars" />
12+
<Icon name="bars" class="open-menu" />
13+
<Icon name="close" class="close-menu" />
1314
</button>
1415
</starlight-menu-button>
1516

@@ -71,6 +72,14 @@ import Icon from '../user-components/Icon.astro';
7172
box-shadow: none;
7273
}
7374

75+
[aria-expanded='true'] button .open-menu {
76+
display: none;
77+
}
78+
79+
:not([aria-expanded='true']) button .close-menu {
80+
display: none;
81+
}
82+
7483
:global([data-theme='light']) button {
7584
background-color: var(--sl-color-black);
7685
color: var(--sl-color-white);

0 commit comments

Comments
 (0)