@astrojs/starlight 0.41.2 → 0.41.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.41.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3911](https://github.com/withastro/starlight/pull/3911) [`1686ecc`](https://github.com/withastro/starlight/commit/1686ecce3fd2da2aa9973faba2dc585abebb93a3) Thanks [@timothyjordan](https://github.com/timothyjordan)! - Keeps keyboard focus inside the mobile menu while it is open, preventing focus moving to hidden interactive elements in page content.
8
+
3
9
  ## 0.41.2
4
10
 
5
11
  ### Patch Changes
@@ -28,11 +28,18 @@ import Icon from '../user-components/Icon.astro';
28
28
  if (parentNav) {
29
29
  parentNav.addEventListener('keyup', (e) => this.closeOnEscape(e));
30
30
  }
31
+
32
+ // Reset menu state when the viewport toggles between mobile and desktop sizes.
33
+ matchMedia('(min-width: 50em)').addEventListener('change', () => this.setExpanded(false));
31
34
  }
32
35
 
33
36
  setExpanded(expanded: boolean) {
34
37
  this.setAttribute('aria-expanded', String(expanded));
35
38
  document.body.toggleAttribute('data-mobile-menu-expanded', expanded);
39
+ // Trap keyboard focus inside the header and menu when the menu is expanded.
40
+ document.querySelectorAll<HTMLElement>('.main-frame, .sl-skip-link').forEach((el) => {
41
+ el.toggleAttribute('inert', expanded);
42
+ });
36
43
  }
37
44
 
38
45
  toggleExpanded() {
@@ -2,7 +2,7 @@
2
2
  import { PAGE_TITLE_ID } from '../constants';
3
3
  ---
4
4
 
5
- <a href={`#${PAGE_TITLE_ID}`}>{Astro.locals.t('skipLink.label')}</a>
5
+ <a class="sl-skip-link" href={`#${PAGE_TITLE_ID}`}>{Astro.locals.t('skipLink.label')}</a>
6
6
 
7
7
  <style>
8
8
  @layer starlight.core {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.41.2",
3
+ "version": "0.41.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",