Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for toggling the built-in search modal using Ctrl+k #1596

Merged
merged 3 commits into from Mar 20, 2024

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Mar 4, 2024

What kind of changes does this PR include?

  • Changes to Starlight code

Description

Got a few complaints that the shortcut to trigger the search modal was not working on Windows.
Turns out that we are only listening for / and cmd + k but not ctrl + k which is a bit of a standard for web applications.

This PR adds support for ctrl + k to trigger the search modal and aligns the behavior with the Algolia one (and https://docs.astro.build at the same time).

Copy link

changeset-bot bot commented Mar 4, 2024

🦋 Changeset detected

Latest commit: ef87b00

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented Mar 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
starlight ✅ Ready (Inspect) Visit Preview Mar 20, 2024 10:09am

Copy link
Member

@Fryuni Fryuni left a comment

Choose a reason for hiding this comment

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

I liked the current behavior because it didn't shadow Chrome's search shortcut, which is also Ctrl+K. So Ctrl is for the browser and Meta is for the site.

But I agree that this is very ubiquitous

@at-the-vr
Copy link
Contributor

I liked the current behavior because it didn't shadow Chrome's search shortcut, which is also Ctrl+K. So Ctrl is for the browser and Meta is for the site.

I suppose you will like Ctrl+L 😉 , the PRs great (LGTM by default)

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks for catching and fixing this @HiDeoo! Left one comment, but agree with the code changes 🙌

.changeset/happy-eggs-switch.md Outdated Show resolved Hide resolved
@delucis delucis added the 🌟 patch Change that triggers a patch release label Mar 20, 2024
@delucis delucis merged commit 13ed30c into withastro:main Mar 20, 2024
9 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Mar 20, 2024
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 🌟 patch Change that triggers a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants