fix(plugin-docsearch): open on ctrl+k when page first loads #478
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.
The
{ once: true }
prevented the listener from properly attachingand listening for a whole ctrl+k event. It would exit early, causing
the page to not function properly on first load.
useEventListener
automatically removes itself on unmount, so I am not sure the purpose of this line. I am hopeful this is not intentional and simple mistake. By approving and merging this PR, you will greatly improve my quality of docs searching. Otherwise, I will need custom scripts :/.Before submitting the PR, please make sure you do the following
close #123
).What is the purpose of this pull request?
Description
The search feature now opens with ctrl+k consistently.
Screenshots
Before
before.mp4
After
after.mp4
The
before
branch adds the plugin inside the e2e thing. I am not sure if that is wanted. It requires some extra setup to test right now. I left that part out of this PR.I am hopeful that once this is merged in that ctrl+k will work on sites like https://www.nushell.sh! :D