Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable search shortcuts#135

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
miketheman wants to merge1 commit intopython:mainfrommiketheman:search-focus

Conversation

miketheman
Copy link
Member

@mikethemanmiketheman commentedJul 25, 2023
edited
Loading

Enable already-existing JavaScript flag.

Included since Sphinx 4.5.0https://www.sphinx-doc.org/en/master/changes.html#release-4-5-0-released-mar-28-2022

Thedoctools.js file that is served today includes the functionality - look forDOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS

Ithink that the only piece needed is setting the config optionenable_search_shortcuts = True inhttps://github.com/python/python-docs-theme/blob/4dbc102a556c520b10fc387821967e54dee77654/python_docs_theme/theme.conf

We inherit fromdefault theme, whichinheritsclassic, which inheritsbasic theme.

Alternative to#131

@ghost
Copy link

ghost commentedJul 25, 2023
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@miketheman
Copy link
MemberAuthor

Sadly, this doesn't work 100% because we create multiple searchbox elements per page with our own layout.

<inputplaceholder="{{ _('Quick search') }}"aria-label="{{ _('Quick search') }}"type="search"name="q"/>

<inputplaceholder="{{ _('Quick search') }}"aria-label="{{ _('Quick search') }}"type="search"name="q"/>

(there's one more, I haven't hunted it down yet)

I'm guessing this would be a little more involved in restructuring the layout template to reduce the duplication, and thus enable taking advantage of their already-supplied functionality. If there's appetite for that, I'll pursue it.

@hugovk
Copy link
Member

Alternative to#131

Nice, I didn't know this was a Sphinx option, I'd prefer to use this than the custom JavaScript in#131. (Although there's not much JS in there.)

https://www.sphinx-doc.org/en/master/usage/theming.html says:

enable_search_shortcuts (true or false): Allow jumping to the search box with/ and allow removal of search highlighting withEsc.

Defaults toTrue.

Does it really default toTrue?

We don't have/ jumping, but we do haveEsc clearing. Where is theEsc coming from?

@miketheman
Copy link
MemberAuthor

Turns out, it does default to True, so this PR is also unnecessary!
That's why the Esc key works already.

Pressing the slash key today does in fact work, however it places the focus on the hidden mobile nav search box since it appears first in the HTML.

🤔

I wonder if we still need an explicit mobile nav, or if the signature could be changed so it still works correctly but does not appear first in the selector.

@miketheman
Copy link
MemberAuthor

Even simpler!#141

@mikethemanmiketheman deleted the search-focus branchJuly 29, 2023 10:33
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@miketheman@hugovk

[8]ページ先頭

©2009-2025 Movatter.jp