Repository navigation
Remove Algolia DocSearch from the search UI - #216
Merged
Merged
Conversation
The UI loaded Algolia DocSearch when a site set the Algolia site keys and didn't register @antora/lunr-extension. The Algolia plan ended on October 31 and the docs site now searches with Lunr, so the fallback can no longer work. - body-end-scripts.hbs no longer loads DocSearch, and the bundle no longer includes it (docsearch.bundle.js, about 129 KB built). - package.json drops @docsearch/js, which takes 22 Algolia and DocSearch packages out of the lock file. It adds @docsearch/css, which @docsearch/js used to bring in: the search dialog reuses DocSearch's markup, so that stylesheet still styles the dialog. It's pinned at 3.7.0, the version in use, so the dialog keeps its look. - The UI preview no longer sets keys for Algolia's demo index, so it has no search box. Those keys replaced all of site.keys, so the preview now also shows the global nav from ui-model.yml.
These parts of the search box and dialog only served Algolia DocSearch, which the UI no longer loads: - The navbar's id="docsearch", where DocSearch mounted its button. The search script now finds the button by its own ID. - The empty logo slot in the dialog's footer, where DocSearch showed Algolia's logo. A footer rule keeps the keyboard shortcuts on the left, so the footer looks the same. - The docsearch.css rules for DocSearch's SVG icons and logo. The dialog's icons are glyphs from the icon font. It also rewords a comment that described Algolia Analytics as current.
The magnifier in the search button and in the dialog's search field was a Material Icons glyph, which a docsearch.css rule drew in place of DocSearch's own icon. Every other icon in the search dialog is a Lucide glyph, so the search box now uses Lucide's search icon too. The icon keeps the 18px width the Material glyph had, so the text beside it doesn't move, and at 15px its drawing is the same size as the Material one. In screenshots of every dialog state, in light and dark mode and on a phone, only the magnifier changed.
A side-by-side test against DocSearch 3.7.0 found a few places where the search dialog still behaved differently. This brings them in line: - Typing a letter or digit while the search button has focus opens the dialog with that character in the field. Shortcuts such as Ctrl+C still do what they normally do. - Shift+Enter opens the highlighted result in a new tab, as Ctrl+Enter and Cmd+Enter do, and leaves the dialog open. - Alt+Enter does nothing, instead of opening the result. - Moving focus from the field to a button or a result (with Tab, say) clears the highlight, and coming back to the field highlights the first result. Switching to another window and back leaves the highlight where it was. - The arrow keys and Enter act on the results only while the field has focus. On a result, the arrow keys scroll the list and Enter opens that result, so the highlight can't point at one result while Enter opens another. - ArrowUp with nothing highlighted goes to the last result, not the second to last. - Clicking a result leaves focus in the field, so the highlight stays on the result under the pointer. - Text selected on the page, which fills the field when the dialog opens, is selected in the field too, so typing replaces it. - Up to 7 recent searches are kept, not 6. Two differences remain on purpose: the dialog returns focus to where it was when it closes, and it has no favorites.
Contributor
|
UI bundle preview build failure! ❌
|
This comment has been minimized.
This comment has been minimized.
GitHub is moving the ubuntu-latest runner from Ubuntu 24.04 to 26.04 between October 19 and November 19, 2026. The 26.04 image no longer installs gulp globally, so the workflows' gulp commands fail with "gulp: command not found". That broke the bundle preview check, and it would stop the release workflow from publishing a bundle. npx runs the gulp that npm ci installs from package-lock.json, the way the site's workflows run Antora.
Contributor
|
UI bundle preview build successful! ✅ |
This comment has been minimized.
This comment has been minimized.
GitHub has deprecated the Node 20 runtime for JavaScript actions. Since June 2026, runners run Node 20 actions on Node 24 instead, and every run warns about it. This moves the workflows to the releases of those actions that are built for Node 24, the same versions the site's workflows use: - actions/checkout v4 -> v6 - actions/setup-node v4 -> v6 - actions/upload-artifact v4 -> v7 - peter-evans/create-or-update-comment v4 -> v5 - peter-evans/find-comment v3 -> v4 None of the inputs these workflows pass changed. setup-node v6 turns on npm caching by itself only when package.json sets packageManager, which this repo doesn't. checkout v6 keeps the job's git credentials in a separate file instead of .git/config; git commands still authenticate as before.
.nvmrc asked for Node 16.20.2 while the workflows installed 21.6.1, so local builds and CI builds ran on different versions of Node and npm. Both versions are also past end of life: Node 16 since September 2023, and Node 21, which was never a long-term support release, since June 2024. Node 24 has security support until April 2028. .nvmrc now says 24, and both workflows read it with node-version-file, so local builds and CI builds use the same version line. The bundle is byte-for-byte the same as with Node 21, and npm 11, which comes with Node 24, leaves package-lock.json as it is. Node 24 prints a deprecation warning (DEP0180) from an older build dependency; it doesn't affect the bundle. Node 26 also builds the bundle, but the site's Antora build doesn't run on it yet, and the two repos are easier to keep on the same version.
The bundle preview workflow wrote the pull request's branch name into
two shell scripts with ${{ }}, which GitHub fills in before the shell
runs. A branch name containing shell syntax would have run as commands
before the step that rejects such names could check it. Both steps now
read the name from an environment variable, so the shell treats it as
data, and the check rejects a bad name as intended.
Pull requests from forks don't get the workflow's secrets, so this
wasn't exploitable from outside the repo, but it's a known script
injection pattern, and actionlint flags it.
Contributor
|
UI bundle preview build successful! ✅ |
This comment has been minimized.
This comment has been minimized.
The setup steps installed and switched to the current LTS release of Node.js (nvm install --lts and nvm use --lts). Node.js 26 became the LTS release on October 28, so those commands now install Node.js 26 rather than the Node.js 24 that .nvmrc sets and the workflows build with. The steps now name Node.js 24, from a nodejs-version attribute at the top of the README that needs to match .nvmrc, and mention that in the project folder nvm reads the version from .nvmrc. nvm also keeps globally installed packages separate for each version of Node.js, so after switching to Node.js 24, a gulp-cli installed under an earlier version isn't there and gulp fails with "command not found". The Gulp CLI section now says to install it again for each version, and that putting npx in front of the gulp commands, as the workflows do, avoids the global install.
The build warned that caniuse-lite is outdated: the browser data that Browserslist uses to work out which browsers "last 2 versions" (set in package.json) covers was from October 2023. This updates caniuse-lite from 1.0.30001554 to 1.0.30001823 with npx update-browserslist-db@latest, which changes only its entries in package-lock.json. With current data, Autoprefixer leaves out -webkit-hyphens, -webkit-backdrop-filter and -webkit-clip-path, which only older versions of Safari (16 and 17) and Samsung Internet (21 and 22) needed, so the bundle's CSS is about 290 bytes smaller. The CSS that docs.datastax.com serves doesn't change: the site's Tailwind step runs Autoprefixer over it again with Tailwind's own browser data, which adds the same prefixes back. Nothing else in the bundle changes.
Contributor
|
UI bundle preview build successful! ✅ |
|
Build successful! ✅ |
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.
Now that the site's search runs on Lunr, this removes what was left of Algolia DocSearch from the UI. It also updates the build for Node 24 and for the Ubuntu 26.04 runner image.
The UI no longer loads DocSearch as a fallback when a site sets the Algolia keys without registering the Lunr extension. The Algolia plan ended on October 31, so that fallback couldn't work anymore. This removes
@docsearch/js, the 22 Algolia and DocSearch packages it brought in, and about 129 KB of built JavaScript from the bundle.@docsearch/cssstays, pinned at 3.7.0, because the search dialog reuses DocSearch's markup and styles. The navbar's DocSearch mount point, the Algolia logo slot in the dialog footer and the CSS for DocSearch's icons are gone too, and the search box uses Lucide's search icon like the rest of the dialog. The UI preview no longer uses Algolia's demo index, so it has no search box.The search dialog also picks up DocSearch 3.7.0's remaining keyboard behaviors, found in a side-by-side test. For example, typing while the search button has focus opens the dialog with that character, Shift+Enter opens the highlighted result in a new tab, the arrow keys and Enter act on the results only while the search field has focus, and up to 7 recent searches are kept. Two differences remain on purpose: the dialog returns focus to where it was when it closes, and it has no favorites.
Build changes:
npx, because the Ubuntu 26.04 image thatubuntu-latestis moving to doesn't install gulp globally..nvmrcsays 24 instead of 16.20.2 (the workflows used 21.6.1), and both workflows read it. The bundle is the same as with Node 21. Node 24 prints a DEP0180 deprecation warning from gulp 4, which doesn't affect the bundle.npx gulpavoids that.-webkit-prefixes for older browsers, but the site's Tailwind step adds them back, so the CSS readers get doesn't change.Once this is released, riptano/datastax-docs-site#374 will point the site's playbooks to the new bundle.