Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for synced tabs #640

Merged
merged 32 commits into from
Apr 30, 2024
Merged

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Sep 4, 2023

What kind of changes does this PR include?

  • Changes or translations of Starlight docs site content
  • Changes to Starlight code

Description

This pull request adds support for synced tabs.

demo.mp4
  • Entirely opt-in.
  • Relies on the syncKey property to enable syncing (can be renamed easily).
  • It does not use an external store like the docs theme editor but everything is colocated in the StarlightTabs web component (we would only have 1 use case for such a store right now so I feel it's easier to follow if everything is scoped to this component).

Regarding testing, now that withastro/astro#7979 has been merged, this PR introduces some E2E tests with an architecture a bit similar to the one in the Astro repo:

  • It uses the new programmatic API to start a dev server for a specific fixture.
  • We can use Playwright to interact with a page and assert that some tabs are synced, some are not, focus is behaving correctly, etc.

The approach is much more lightweight than the one in the Astro repo as we don't need at the moment so much features (edits, builds and preview, etc.). My idea was to make it as simple as possible to get started with E2E tests for what I needed in this PR and then, we can iterate on it depending on our needs. Maybe we will also want to add E2E tests for some other already existing features but I think it might be better to do it in a separate PR (or we could also only add tests for existing features when we get bug reports for them as regression tests).

I also edited the CONTRIBUTING.md file to add a section about E2E tests with an emphasis on the fact that they should only be used for parts that cannot be properly tested with unit tests (e.g. client code for user interactions).

Hope this is what you had in mind Chris when you mentioned the programmatic API in #462. Happy to discuss any part of this PR if needed.

@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2023

🦋 Changeset detected

Latest commit: 6f12a6b

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 Minor

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 4, 2023

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit c056462
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/6515849748464e0007cfa4de
😎 Deploy Preview https://deploy-preview-640--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 (no change 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 site configuration.

@github-actions github-actions bot added 🚨 action Changes to GitHub Action workflows 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Sep 4, 2023
delucis and others added 3 commits September 28, 2023 15:50
* main: (440 commits)
  i18n(fr): update `getting-started.mdx` (withastro#1245)
  [ci] format
  docs(showcase): add csmos.space (withastro#1269)
  [ci] format
  docs: add SiteOne Crawler to showcase (withastro#1264)
  Fix formatting
  [ci] format
  docs(i18n): Add Indonesian translation for site search documentation (withastro#1250)
  i18n(es): fix typo (withastro#1246)
  i18n(ja): Update getting-started.mdx (withastro#1252)
  i18n(es): Update `getting-started.mdx` (withastro#1247)
  i18n(ko-KR): update `getting-started.mdx` (withastro#1248)
  Update upgrade instructions to show new `@astrojs/upgrade` (withastro#1241)
  [ci] format
  [ci] release (withastro#1240)
  i18n(ru): Fix typo in `i18n.untranslatedContent` (withastro#1243)
  Fix timezone-reliance in LastUpdated (withastro#1170)
  Prefetch links on hover by default (withastro#1242)
  Add support for Astro v4, drop support for Astro v3 (withastro#1238)
  Add Matrix social icon (withastro#1203)
  ...
Copy link

vercel bot commented Dec 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
starlight ✅ Ready (Inspect) Visit Preview Apr 30, 2024 3:19pm

* main: (419 commits)
  i18n(fr): Update `guides/i18n.mdx` with <Steps> (withastro#1652)
  i18n(es): update `site-search` (withastro#1666)
  i18n(fr): Update `resources/plugins.mdx` with LinkCard Zoom (withastro#1654)
  i18(zh-cn): Update i18n.mdx (withastro#1672)
  i18(zh-cn): Update customization.mdx (withastro#1671)
  [ci] format
  i18n(it): Update css-and-tailwind.mdx (withastro#1643)
  [ci] format
  i18n(it): Update customization.mdx (withastro#1642)
  [ci] format
  i18n(es): update `overriding-components` (withastro#1670)
  i18n(fr): Update `guides/customization.mdx` with <Steps> (withastro#1650)
  [ci] format
  i18n(es): update `css-and-tailwind` (withastro#1669)
  i18n(es): updates `customization` (withastro#1668)
  i18n(it): Update i18n.mdx (withastro#1645)
  i18n(es): update `i18n` (withastro#1667)
  i18n(it): Update site-search.mdx (withastro#1644)
  [ci] format
  i18n(fr): Update `guides/overriding-components.mdx` in MDX format and with <Steps> (withastro#1655)
  ...
@HiDeoo
Copy link
Member Author

HiDeoo commented Mar 26, 2024

Just updated the pull request and also added a new behavior to avoid scroll position changes when alternating between tabs which could happen for example when switching between tabs with different content height.

@HiDeoo
Copy link
Member Author

HiDeoo commented Apr 15, 2024

Thanks for another great review, super appreciated 🙌

Everything noticed so far should be fixed now until further changes are requested.

HiDeoo and others added 2 commits April 30, 2024 09:44
* main: (21 commits)
  Update fa.json (withastro#1793)
  i18n(fr): update `resources/community-content.mdx` (withastro#1795)
  [ci] format
  i18n(ko-KR): update `community-content.mdx` (withastro#1794)
  [ci] format
  Adds Starlight in Next.js project video (withastro#1789)
  [ci] format
  i18n(ru): update translations (withastro#1783)
  i18n(id): Update getting-started.mdx (withastro#1778)
  Upgrade Lunaria and add Action (withastro#1768)
  [ci] format
  i18n(es): update `sidebar` (withastro#1767)
  i18n(pt-br): Update `getting-started.mdx` (withastro#1776)
  i18n(es): update `configuration` (withastro#1766)
  [ci] format
  Add TrueCharts to showcases (withastro#1773)
  i18n(zh-cn): Update `sidebar.mdx` (withastro#1761)
  i18n(ko-KR): update `sidebar.mdx` (withastro#1760)
  i18n(fr): update `guides/sidebar` (withastro#1758)
  test: fix Windows path separator test issues (withastro#1759)
  ...
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
@astrobot-houston
Copy link
Collaborator

astrobot-houston commented Apr 30, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en getting-started.mdx Source changed, localizations will be marked as outdated.
en guides/components.mdx Source changed, localizations will be marked as outdated.
en guides/css-and-tailwind.mdx Source changed, localizations will be marked as outdated.
en guides/customization.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

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.

Approving for release! Still working my way through our PR backlog, but this should be able to go out later today.

Thank you for the work on this @HiDeoo — probably taking the award for longest lived PR so far 😅

@delucis delucis added the 🌟 minor Change that triggers a minor release label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 action Changes to GitHub Action workflows 🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes 🌟 minor Change that triggers a minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants