Skip to content

Conversation

@andersk
Copy link
Contributor

@andersk andersk commented Sep 11, 2025

The <summary> element must be the first child of <details>.

@changeset-bot
Copy link

changeset-bot bot commented Sep 11, 2025

🦋 Changeset detected

Latest commit: a127aac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Sep 11, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit a127aac
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/68cbfc7caabcba00081428f8
😎 Deploy Preview https://deploy-preview-3423--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (🟢 up 10 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Sep 11, 2025
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @andersk! Just for context, do you have some examples of where this was causing issues?

@andersk
Copy link
Contributor Author

andersk commented Sep 13, 2025

I’m just trying to get my Starlight output to pass an HTML validator. (Example.) Of course I’m aware that not all validation errors are problems in the real world, so I’m filtering out a mix of validator bugs, legitimate nonstandard extensions, and browser bug workarounds to find the real issues. This case clearly does violate the standard, so even if it doesn’t cause problems in practice with today’s common browsers, we might as well fix it to make it easier for real issues to stand out.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extra context @andersk!

I was hesitant just because the sidebar restoration logic here is a little subtle, but I tested it again and I think this change is safe.

Ideally, we do want the restore point as early as possible in the DOM, so I’ve suggested an alternative refactor. What do you think? Both work in practice, just thinking what’s the most minimal change in terms of execution order (the <SidebarRestorePoint> component renders a custom element which controls the collapsed state of the parent <details>)

>
<SidebarRestorePoint />
<summary>
<div class="group-label">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if another option here would be to move the restore point inside the <summary> so it’s still as early as possible in the tree:

Suggested change
<div class="group-label">
<SidebarRestorePoint />
<div class="group-label">

</div>
<Icon name="right-caret" class="caret" size="1.25rem" />
</summary>
<SidebarRestorePoint />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then remove it here:

Suggested change
<SidebarRestorePoint />

@andersk
Copy link
Contributor Author

andersk commented Sep 15, 2025

Yeah that seems fine to me: this.closest('details') in SidebarPersister will still be able to find <details>. Updated.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great — thanks again @andersk 🙌

@delucis delucis added the 🌟 patch Change that triggers a patch release label Sep 15, 2025
@delucis
Copy link
Member

delucis commented Sep 15, 2025

Oops, I should have tested this before suggesting it 😅
image

Might be best to go with your original suggestion after all 👍 (Or introduce styles, but that seems overkill?)

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @andersk — I restored your initial suggestion given the layout issues with mine.

@delucis delucis merged commit a0d0670 into withastro:main Sep 18, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Sep 18, 2025
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Oct 2, 2025
* main: (26 commits)
  i18n(ja): resources/themes (withastro#3442)
  add openstatus showcase (withastro#3436)
  [ci] release (withastro#3434)
  Add `head` config validation for `meta` tags with `content` (withastro#3380)
  Fix Astro Island margins in Markdown (withastro#3340)
  Ensure tab links span the full tab height (withastro#3427)
  Move `<summary>` to top of `<details>` for validity (withastro#3423)
  Run all tests on CI workflow changes (withastro#3433)
  [ci] format
  i18n(fr): small rewording and fixes in top-level pages (withastro#3432)
  i18n(fr): small rewording and fixes in `guides` (withastro#3431)
  i18n(fr): fix typo and links in `reference` files (withastro#3429)
  i18n(fr): small rewording in `components` (withastro#3430)
  [ci] release (withastro#3384)
  i18n(de): Update `page.lastUpdated` translation to be more in‐line with the English translation (withastro#3416)
  Remove invalid value attribute from `<select>` (withastro#3421)
  Convert invalid `<div>` child of `<summary>` to `<span>` (withastro#3422)
  [i18nIgnore] Fix typo in Spanish docs documentation (withastro#3408)
  chore(deps): update actions/labeler action to v6.0.1 (withastro#3407)
  [i18nIgnore] Fix duplicate i18n collection definition (withastro#3409)
  ...
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Oct 7, 2025
* main: (72 commits)
  Showcase: Add Saucer (withastro#3454)
  i18n(ja): resources/themes (withastro#3442)
  add openstatus showcase (withastro#3436)
  [ci] release (withastro#3434)
  Add `head` config validation for `meta` tags with `content` (withastro#3380)
  Fix Astro Island margins in Markdown (withastro#3340)
  Ensure tab links span the full tab height (withastro#3427)
  Move `<summary>` to top of `<details>` for validity (withastro#3423)
  Run all tests on CI workflow changes (withastro#3433)
  [ci] format
  i18n(fr): small rewording and fixes in top-level pages (withastro#3432)
  i18n(fr): small rewording and fixes in `guides` (withastro#3431)
  i18n(fr): fix typo and links in `reference` files (withastro#3429)
  i18n(fr): small rewording in `components` (withastro#3430)
  [ci] release (withastro#3384)
  i18n(de): Update `page.lastUpdated` translation to be more in‐line with the English translation (withastro#3416)
  Remove invalid value attribute from `<select>` (withastro#3421)
  Convert invalid `<div>` child of `<summary>` to `<span>` (withastro#3422)
  [i18nIgnore] Fix typo in Spanish docs documentation (withastro#3408)
  chore(deps): update actions/labeler action to v6.0.1 (withastro#3407)
  ...
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Oct 14, 2025
* main: (87 commits)
  i18n(ja): sync outdated aside page (withastro#3465)
  i18n(ja): sync outdated icon reference (withastro#3467)
  chore(deps): update pnpm/action-setup action to v4.2.0 (withastro#3460)
  Showcase: Add Saucer (withastro#3454)
  i18n(ja): resources/themes (withastro#3442)
  add openstatus showcase (withastro#3436)
  [ci] release (withastro#3434)
  Add `head` config validation for `meta` tags with `content` (withastro#3380)
  Fix Astro Island margins in Markdown (withastro#3340)
  Ensure tab links span the full tab height (withastro#3427)
  Move `<summary>` to top of `<details>` for validity (withastro#3423)
  Run all tests on CI workflow changes (withastro#3433)
  [ci] format
  i18n(fr): small rewording and fixes in top-level pages (withastro#3432)
  i18n(fr): small rewording and fixes in `guides` (withastro#3431)
  i18n(fr): fix typo and links in `reference` files (withastro#3429)
  i18n(fr): small rewording in `components` (withastro#3430)
  [ci] release (withastro#3384)
  i18n(de): Update `page.lastUpdated` translation to be more in‐line with the English translation (withastro#3416)
  Remove invalid value attribute from `<select>` (withastro#3421)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants