@astrojs/starlight 0.41.1 → 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,19 @@
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
+
9
+ ## 0.41.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#4008](https://github.com/withastro/starlight/pull/4008) [`58a3520`](https://github.com/withastro/starlight/commit/58a352097016ffbd98716688e4f2dfb97e5a6f44) Thanks [@FrancoKaddour](https://github.com/FrancoKaddour)! - Fixes the table of contents overflowing the right edge of the viewport when a custom `--sl-content-width` value exceeds available space
14
+
15
+ - [#4015](https://github.com/withastro/starlight/pull/4015) [`bdbfffc`](https://github.com/withastro/starlight/commit/bdbfffc044dbf119e5085c3e67722494ae3c85c6) Thanks [@delucis](https://github.com/delucis)! - Fixes an issue where aside icons were rendered incorrectly in projects where Astro’s MDX integration had optimization disabled
16
+
3
17
  ## 0.41.1
4
18
 
5
19
  ### 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 {
@@ -21,8 +21,11 @@
21
21
  .right-sidebar-container {
22
22
  order: 2;
23
23
  position: relative;
24
- width: calc(
25
- var(--sl-sidebar-width) + (100% - var(--sl-content-width) - var(--sl-sidebar-width)) / 2
24
+ width: max(
25
+ var(--sl-sidebar-width),
26
+ calc(
27
+ var(--sl-sidebar-width) + (100% - var(--sl-content-width) - var(--sl-sidebar-width)) / 2
28
+ )
26
29
  );
27
30
  }
28
31
 
@@ -45,8 +48,11 @@
45
48
  --sl-content-margin-inline: auto 0;
46
49
 
47
50
  order: 1;
48
- width: calc(
49
- var(--sl-content-width) + (100% - var(--sl-content-width) - var(--sl-sidebar-width)) / 2
51
+ width: min(
52
+ calc(100% - var(--sl-sidebar-width)),
53
+ calc(
54
+ var(--sl-content-width) + (100% - var(--sl-content-width) - var(--sl-sidebar-width)) / 2
55
+ )
50
56
  );
51
57
  }
52
58
  }
@@ -103,6 +103,15 @@ function satteriAsidesPlugin(
103
103
 
104
104
  const icon = getAsideIcon(variant, node.attributes?.['icon']);
105
105
  const iconSvg = `<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" class="starlight-aside__icon">${icon}</svg>`;
106
+ // Markdown and MDX require different AST shapes for raw HTML content.
107
+ // TODO: replace endsWith check with an official Sätteri API once available.
108
+ const iconNode = ctx.fileURL?.pathname.endsWith('.mdx')
109
+ ? {
110
+ type: 'mdxJsxTextElement',
111
+ name: 'Fragment',
112
+ attributes: [{ type: 'mdxJsxAttribute', name: 'set:html', value: iconSvg }],
113
+ }
114
+ : { type: 'html', value: iconSvg };
106
115
 
107
116
  return paragraphElement(
108
117
  'aside',
@@ -112,7 +121,7 @@ function satteriAsidesPlugin(
112
121
  },
113
122
  [
114
123
  paragraphElement('p', { class: 'starlight-aside__title', 'aria-hidden': 'true' }, [
115
- { type: 'html', value: iconSvg },
124
+ iconNode,
116
125
  ...titleNode,
117
126
  ]),
118
127
  paragraphElement('div', { class: 'starlight-aside__content' }, children),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.41.1",
3
+ "version": "0.41.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@astrojs/markdown-remark": "^7.2.0",
55
- "@playwright/test": "^1.59.1",
55
+ "@playwright/test": "^1.61.1",
56
56
  "@types/node": "^22.19.17",
57
57
  "@vitest/coverage-v8": "^4.1.5",
58
58
  "astro": "^7.0.2",