Fix <Tabs> sync issue with inconsistent use of icon on <TabItem> components#1811
Merged
delucis merged 3 commits intowithastro:mainfrom May 6, 2024
Merged
Conversation
…<TabItem>` components
🦋 Changeset detectedLatest commit: fa9146f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Merged
HiDeoo
added a commit
to HiDeoo/starlight
that referenced
this pull request
May 8, 2024
* main: i18n(zh-cn): Update docs about synced-tabs (withastro#1834) i18n(zh-cn): Update some docs about withastro#1620 & withastro#1613 (withastro#1835) Add more diagnostic help to error messages thrown by `<Steps>` (withastro#1838) i18n(zh-cn): Update components.mdx (withastro#1836) i18n(zh-cn): Update community-content.mdx (withastro#1833) Improve type checking job (withastro#1831) [ci] format [ci] release (withastro#1832) i18n(ru): update ru.json (withastro#1826) Fix `<Tabs>` sync issue with inconsistent use of `icon` on `<TabItem>` components (withastro#1811) Enable `BASE_URL` tests (withastro#1828)
Yoxnear
pushed a commit
to Yoxnear/starlight-custom
that referenced
this pull request
Jul 23, 2025
…` components (withastro#1811) Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue with synced tabs when
<Tabs>sharing the samesyncKeyhave<TabItem>components that inconsistently useiconor not.The issue is due to the fact that labels (which need to be identical for tabs to sync) were coming from the
textContentproperty on the tab link which gets the content of all elements. In the presence of an icon, thetextContentproperty could potentially include extra spaces due to the presence of the SVG icon.This pull request fixes the issue by using the
innerTextproperty instead oftextContentto get the label text as it only returns the rendered text content, which is the exact label text we want to compare.