Skip to content

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Jul 23, 2025

Description

This draft PR is a very early version of a rewrite of the Pagefind UI that is used in Starlight.

This is a work in progress and is not ready for production or even for a full review yet. A lot of work is still needed to get it to a point where it can be used in Starlight. Most of the work has only been done in 1 browser and parts of the UI have been tested in isolation against only 1 screen reader so far so it'll require a lot of testing and improvements before it can be considered ready in its entirety.

The main goal of having more control over the search UI and improving the accessibility of the search experience in Starlight.

A few important points to note:

  • Filters are always visible as some have been configured in the content which is not the case in the live version of the documentation.
  • Translations are now part of Starlight although I did not port the existing ones from the original Pagefind UI. That was my original idea although after checking the French one, I was not pleased with some of the translations. We can think about it later.
  • Most of the UI mimics the original Pagefind UI as closely as possible to iterate faster on a working veersion. Only a few parts may have changed, e.g. always-visible query input or filters disclosure icon now matching the one used in the Starlight Markdown UI, etc.
  • The current UI used in the live version of the documentation was potentially limited due to the lack of control when using the original Pagefind UI. Something to potentially consider later is if there are any changes to the original UI that we would like to see in this version.
    • Something coming to mind could be an always-visible query input but that's a decision that should be made later. This PR implements an always-visible query input but it's not looking great and was mostly done to make testing easier (in a dedicated commit so it can be easily reverted later if needed).

An interesting search is upgrade:

Development notes:

  • This PR adds the pnpm pagefind command to the docs/ directory which should be used when iterating on this PR:
    • It simultaneously runs a dev version of the docs running on the 4321 port and a prod version on the 4322 port.
    • When developing, visiting http://localhost:4321 will use the search indexes from the prod version which allows for using/testing/iterating on the search UI (note that changes that would result in a change to the search indexes will require running the pnpm pagefind command again).

Remaining todos

  • Look for any TODO(HiDeoo) remaining comments and address them.
  • Add changeset(s)

Copy link

changeset-bot bot commented Jul 23, 2025

⚠️ No Changeset found

Latest commit: 703307e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

netlify bot commented Jul 23, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 703307e
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/68de45a8eb9dec0008585d01
😎 Deploy Preview https://deploy-preview-3335--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: 99 (🟢 up 27 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 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Jul 23, 2025
@astrobot-houston
Copy link
Contributor

astrobot-houston commented Jul 23, 2025

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 demo/trigger-filters.md Source added, will be tracked.
en demo/trigger-search.md Source added, will be tracked.
en guides/i18n.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.

@HiDeoo
Copy link
Member Author

HiDeoo commented Jul 30, 2025

Alongside some minor changes and improvements, this PR now also includes an always-visible query input. It does not looks great and it's part of the points I initially mentioned in the description of this PR that should be discussed regarding potential changes to the original Pagefind UI.

The main reason I quickly implemented it is to make testing easier as the original design was not very convenient when using the search UI a lot. It's in a dedicated commit so it can be easily reverted later if needed.

@HiDeoo
Copy link
Member Author

HiDeoo commented Aug 13, 2025

Updated the PR to adds support for new features which are currently not supported at all in Starlight. To decide which features to implement first, I looked at the various feature requests that have been opened and also what is currently being done in the ecosystem.

@HiDeoo
Copy link
Member Author

HiDeoo commented Aug 20, 2025

Updated the PR based on the feedback from T&D (14 August 2025):

  • When present, the "Load more results" is now always visible in a footer of the modal. Like the always-visible query input, it's definitely not a definitive or even thought-out design, but more of an experiment.
  • Refactor the API design to avoid the need to querySelector some web components. All pagefind related exports are now available from the @astrojs/starlight/pagefind module which exposes a getPagefindApi function that returns an object with methods to trigger filters and search.

HiDeoo added 7 commits August 27, 2025 15:33
* main: (137 commits)
  i18n(fr): update `resources/themes.mdx` (withastro#3399)
  i18n(de): translate `themes.mdx` (withastro#3397)
  [ci] format
  i18n(ko): translate `themes.mdx` (withastro#3398)
  [ci] format
  docs: add Starlight Page to themes showcase (withastro#3393)
  i18n(de): update German themes (withastro#3394)
  docs: change image of Starlight Galaxy Theme dark image to not include a visible scrollbar (withastro#3395)
  [ci] format
  i18n(ko-KR): update `themes.mdx` (withastro#3392)
  [ci] format
  Add link to new Starlight theme (withastro#3390)
  i18n(fr): update `guides/css-and-tailwind.mdx` (withastro#3389)
  i18n(de): translate `guides/css-and-tailwind.mdx` (withastro#3386)
  [ci] format
  i18n(ko-KR): update `css-and-tailwind.mdx` (withastro#3388)
  Adds OmniPrint documentation to the showcase (withastro#3387)
  docs(showcase): Add Aptos Docs (withastro#3385)
  docs: add section about multiple Tailwind configs (withastro#3273)
  Add basic ESLint config, lint script and lint CI job (withastro#1640)
  ...
* 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
Copy link
Member Author

HiDeoo commented Oct 2, 2025

Due to various UI changes that happened in the course of this PR, e.g. an always-visible search input or load more button (when applicable), the current UI entirely relying on the previous design feels a bit "heavy" in my opinion around these changes.

Sharing here a few screenshots of more compact versions of the same UI (not included in this PR) for reference and discussion. I am obviously not the best when it comes to design, so only sharing as these parts of the UI have been on my mind while working on this PR. As we now have entire control over the UI, there is also more room for customization depending on where we want to take this in the future.

Current
SCR-20251001-okga
Experiments
SCR-20251002-jnsr SCR-20251001-ohle SCR-20251002-jznw

@HiDeoo HiDeoo marked this pull request as ready for review October 2, 2025 10:19
@ematipico
Copy link
Member

ematipico commented Oct 14, 2025

Tested on Firefox Developer Tools (desktop):

  • The height of the modal is smaller than before, which affects the visibility of the results shown. I preferred the previous height

    Screenshot 2025-10-14 at 11 21 05

One minor (nitpick) drawback on mobile. Now that input search (header) and more results (footer) are sticky, when clicking "More results", you don't have a visual change anymore that shows that new results were loaded.

@HiDeoo
Copy link
Member Author

HiDeoo commented Oct 14, 2025

Thanks for the great feedback 🙌

Definitely agree, and this is also something I've started looking at in #3335 (comment) (screenshots included).

To give a bit more context, this PR initially started by a rewrite to improve the accessiblity, but as we now have more control, some UI/UX changes have also started to make sense. So far, such changes have been added with minimal effort regarding the design aspect which explains such large padding around some elements. As I'm also not the best when it comes to design, this is also something where Chris inputs would be very valuable.

Regarding the last point, definitely something that is missing right now, great reminder. Such indicators have been implemented for screen-readers, but not visually yet. I'm guessing these would be added once we have a better idea of the overall design direction.

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 📚 docs Documentation website changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants