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

Typing s opens search #1204

Closed
briantliao opened this issue Apr 28, 2020 · 8 comments · Fixed by #2311
Closed

Typing s opens search #1204

briantliao opened this issue Apr 28, 2020 · 8 comments · Fixed by #2311
Labels
A-Configuration Area: Configuration A-Search Area: Search

Comments

@briantliao
Copy link

When you type s, it opens search. Is there a way to disable this?

@ehuss ehuss added A-Configuration Area: Configuration A-Search Area: Search A-UI Area: UI/UX of generated pages and removed A-UI Area: UI/UX of generated pages labels May 10, 2020
@daniel-vainsencher
Copy link

I want to have a form in the about page of my website, and this makes s challenging to enter... currently only workaround I've found is to disable search entirely, which seems a bit extreme.

I propose to enable user to override the keycode activating search (including disabling keyboard activation) by:

  • Add a field of "search keycode" to [output.html.search]
  • Write it out to the html with a node id (somewhere in hbs_rendererer.rs?)
  • getElementById for that node in searcher.js, use it to initialize the SEARCH_HOTKEY_KEYCODE (or not).

I've never written js in my life, but this doesn't look too challenging (actually, a sketch of the js part). PR welcome? if so, happy to hear any improvements to the plan above.

@ehuss
Copy link
Contributor

ehuss commented May 31, 2021

I would prefer to avoid adding configuration here if possible. Is there a reason that the check to avoid conflict isn't working for your form?

@daniel-vainsencher
Copy link

Ah, I hadn't understood that mechanism. It is because the fields's type is not one of the excluded types, it is "email". I can make the trivial PR to also include email, though this does seem a bit of a whack-a-mole (I might find myself using a different new field type tomorrow). Perhaps it would be better to instead enumerate the types that mdbook uses in normal operation, and apply the s behavior only to them?

@daniel-vainsencher
Copy link

daniel-vainsencher commented Jun 6, 2021

@ehuss ^ ? the trivial PR does work for me, for now I am using a fork that excludes the "email" field.

Edit: now known as #1569

@ehuss
Copy link
Contributor

ehuss commented Jun 6, 2021

Perhaps it would be better to instead enumerate the types that mdbook uses in normal operation, and apply the s behavior only to them?

If you know of a way to do that, feel free to open a PR! I'm not sure if it is possible to check for an "allowed" list, though.

@sspaeti
Copy link
Contributor

sspaeti commented Feb 5, 2024

@briantliao any reason this was closed? The PR #1569 was unfortunately not merged yet. I added a comment there; the comment from @ehuss worked perfectly fine.

I would love to get this merged so others do not have the same problem when adding a simple sign-up form from a newsletter or similar.

@briantliao
Copy link
Author

It was old… yes would like to have it merged please.

@briantliao briantliao reopened this Feb 5, 2024
@sspaeti
Copy link
Contributor

sspaeti commented Feb 6, 2024

I created a new PR (#2311) that is ready to merge. I'm running that version on my book and e.g. this form allows you to enter s without the search popping up. Search is still active for everything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Configuration Area: Configuration A-Search Area: Search
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants