Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

feat(docsearch): introduce DocSearch.js v3 #56

Merged
merged 4 commits into from
Jul 9, 2020

Conversation

francoischalifour
Copy link
Owner

This introduces the package @docsearch/js to use DocSearch v3 in vanilla JavaScript projects.

Technical details

The vanilla package is a simple call to the DocSearch component from @docsearch/react, with an alias to Preact.

This means we share a single codebase, and that any feature or fix applied to @docsearch/react will get propagated to @docsearch/js.

Importing styles

The way to import style has changed internally, but it's transparent to the @docsearch/react package.

We now publish a package called @docsearch/css that gathers all the styles: complete style, or partials (variables, search button and modal). These styles are re-exported from @docsearch/react.

Next steps

Search button acting as an input

The way we treat the search button as an input (see #54) doesn't work with Preact. This behaves differently because Preact better respects the native DOM focus management than React, which disallows to assign the focus to an element that gets added to the DOM after the page load. I plan to add support for this in another PR.

Algolia user agents

If we want to better track Algolia user agents, we need to find a way to alter the user agents sent to differentiate between @docsearch/react and @docsearch/js.

E2E testing

We might want to E2E-test with Cypress this new vanilla package to make sure that it acts as the React one.

@francoischalifour francoischalifour requested a review from Shipow July 8, 2020 12:47
Copy link
Collaborator

@s-pace s-pace left a comment

Choose a reason for hiding this comment

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

Well done 👏
Let's make sure we can distinguish the user_agent indeed

Congrats

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants