Skip to content

Update to DocSearch v5 - #14953

Draft
HiDeoo wants to merge 7 commits into
withastro:mainfrom
HiDeoo:hd/docsearch-plugin
Draft

HiDeoo wants to merge 7 commits into
withastro:mainfrom
HiDeoo:hd/docsearch-plugin

Conversation

@HiDeoo

@HiDeoo HiDeoo commented Nov 23, 2026

Copy link
Copy Markdown
Member

Description (required)

This PR removes the custom implementation of DocSearch v3 and updates it to use DocSearch v5 using the official Starlight DocSearch plugin. This PR is still a draft as it currently uses a preview release of the next minor version of the Starlight DocSearch plugin.

Most of the changes can be split into 2 categories:

  • removing our custom implementation of DocSearch v3
  • normalizing translations keys to match the plugin's ones

References

Remaining Tasks

  • Wait for an official release of the Starlight DocSearch plugin (currently a preview release)
  • Merge with the following Lunaria directive: @lunaria-track:src/content/i18n/en.yml

@github-actions github-actions Bot added the i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help! label Nov 23, 2026
@astrobot-houston

astrobot-houston commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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 tracking.ignoredKeywords 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

File Note
i18n/ar.yml Localization changed, will be marked as complete.
i18n/de.yml Localization changed, will be marked as complete.
i18n/en.yml Source changed, localizations will be marked as outdated.
i18n/es.yml Localization changed, will be marked as complete.
i18n/fr.yml Localization changed, will be marked as complete.
i18n/hi.yml Localization changed, will be marked as complete.
i18n/it.yml Localization changed, will be marked as complete.
i18n/ja.yml Localization changed, will be marked as complete.
i18n/ko.yml Localization changed, will be marked as complete.
i18n/pl.yml Localization changed, will be marked as complete.
i18n/pt-BR.yml Localization changed, will be marked as complete.
i18n/ru.yml Localization changed, will be marked as complete.
i18n/zh-CN.yml Localization changed, will be marked as complete.
i18n/zh-TW.yml Localization changed, will be marked as complete.
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.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Preview deployment

✅ Deployment complete!

@delucis delucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn’t check yet the source of this (could Docsearch upstream, Starlight upstream, or here in docs), but noting that some contrast levels seem to be failing:
light mode contrast failure on the highlighted text in a result
dark mode contrast failure in the dim text on a selected result

@HiDeoo

HiDeoo commented Nov 23, 2026 •

Copy link
Copy Markdown
Member Author

Yeah, this is one of the issues I've spotted so far and I think this is an upstream regression.

In DocSearch v3, we had a dedicated --docsearch-hit-active-color CSS variable for the text of the selected hit, which made it easy to use a different color depending on wheter a hit was selected or not. In DocSearch v5, there is only a single --docsearch-highlight-color CSS variable used for highlighted text in both states (which is also why the selected state isn't a closer match of DocSearch v3).

We could override it in the Starlight plugin but this feels more like a regression and a limitation other users could also run into rather than something specific to our setup (and would also adding more override based on internal CSS classes in our plugin).

@HiDeoo

HiDeoo commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

I spent a bit of time on this. Even tho it could seem like an upstream regression or limitation, fixing it upstream could be a major and significant change and there is also no guarantee that it would be accepted.

I found a way to work around the issue without relying on more internal CSS selectors while keeping the v5 design direction (a subtle background for the selected hit) rather than bringing back the v3 design (which I don't think is what users would expect). I kept the accent border on the selected hit I already added prior to this report and the selected hit background now uses color-mix() to blend a small amount of the accent color into the hit background.

I tested it with both light and dark themes of the default theme and also with other presets from the theme editor and it seems to fix the issue consistently.

Theme Dark Light
Default SCR-20261124-144925@2x SCR-20261124-144950@2x
Ocean SCR-20261124-145010@2x SCR-20261124-145020@2x
Forest SCR-20261124-145034@2x SCR-20261124-145123@2x
Oxide SCR-20261124-145142@2x SCR-20261124-145203@2x
Nebula SCR-20261124-145221@2x SCR-20261124-145240@2x

@delucis

delucis commented Nov 24, 2026

Copy link
Copy Markdown
Member

Thanks for exploring @HiDeoo! I actually was just coming to share my own similar exploration. I was looking at how the modal works on the DocSearch docs and I think if we take some cues from there we can have less issues and likely also avoid needing things like color-mix().

The basic approach was to avoid highlighting each result and not to use the grey shade for the modal interior. That means we start from a higher contrast background colour for the modal and can then use our gray-6 as the background colour for the currently highlighted result:

Dark Light
image image

This also helps in the AI response mode for making stuff like the “speech bubbles” in the chat stand out:

Dark Light
image image

I also noted down some other small tweaks to ensure contrast/improve a11y.

I didn’t try yet with different theme presets like you did though — will do that now and if it seems to be working, I will share a patch in the Starlight PR so others can try it.

@HiDeoo

HiDeoo commented Nov 24, 2026 •

Copy link
Copy Markdown
Member Author

and not to use the grey shade for the modal interior

Oh, interesting. It's actually one of the first implementation I initially tried (as you mentioned it's how it works in the DocSearch docs), and ended up dismissing it almost immediately 😅 I personally didn't like having the input, dialog body and footer having the same background color.

Altho, it's purely a matter of personal preference from me and we know I'm not the best at design choices anw, so if you think it's fine and works better this way, I'm more than happy to go with it.

@delucis

delucis commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

I personally didn't like having the input, dialog body and footer having the same background color.

Yeah, that’s also a fair observation.

Here’s a quick side-by-side for our two approaches to compare:

Yours Mine
image image

The benefit to me of the single background colour is that it removes the noise of all the element borders from the UI, so you can cleanly see the text and especially the currently highlighted result. (For example, on the left, the highlighted/focused result actually has less contrast from the rest of the UI so stands out a bit less even though technically it is the “more important” UI element.)

Where I agree with you in particular is that I would like the text input to look a bit more like a text input, and having it be white in your version helps a bit — especially in the initial state when a user is about to type. I’m not sure that’s achievable with my approach though.

I’m now finishing up a review on the Starlight PR that includes detailed comments for each of the tweaks I made, so then you can perhaps see them in context and decide what you think.

Edit: Posted my review: withastro/starlight#3346 (review)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n Anything to do with internationalization & translation efforts - ask @YanThomas for help!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants