GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Focus search box when pressing slash by hugovk · Pull Request #131 · python/python-docs-theme

Conversation

@hugovk

@hugovk hugovk commented Jun 15, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #130.

Many websites focus the search box when the forward slash / key is pressed.

For example:

  • Furo theme https://pradyunsg.me/furo/quickstart/
  • PyPI https://pypi.org/project/python-docs-theme/
  • GitHub Focus search box when pressing slash #130
  • YouTube https://www.youtube.com/watch?v=nMekFX2CDVk
  • Discord https://discuss.python.org/

Let's do the same.

Demo

https://python-docs-theme-previews--131.org.readthedocs.build/en/131/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hugovk
Focus search box when pressing slash
0a28294
ezio-melotti
ezio-melotti reviewed Jun 15, 2023
View reviewed changes
Comment thread python_docs_theme/static/search-focus.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hugovk
Allow / to be entered into search box, don't focus if edit already fo…
e6c79f4
…cused
@miketheman miketheman mentioned this pull request Jul 25, 2023
Enable search shortcuts #135
Closed
miketheman added a commit to miketheman/python-docs-theme that referenced this pull request Jul 27, 2023
@miketheman
fix: override correct tag
788fee7
When the template was made responsive, the choice was made to override
the `body_tag` fragment.
The `body_tag` block is a literal `<body>` which allows the theme developer
to set properties on the `body` tag.
See: sphinx-doc/sphinx#4140

Instead, use the `document` block as documented.
https://www.sphinx-doc.org/en/master/development/templating.html#blocks

Overriding the correct block places the `mobile-nav` section _after_ the
majority of the other HTML parts, which enables the correct function of
the `/` keyboard shortcut.

Resolves python#130
Closes python#131
Closes python#135

Signed-off-by: Mike Fiedler <[email protected]>
@miketheman miketheman mentioned this pull request Jul 27, 2023
Use correct block, enable built-in slash keypress #141
Merged
@hugovk hugovk closed this in #141 Jul 29, 2023
@hugovk
hugovk deleted the search-focus branch July 30, 2023 09:43
@hugovk
hugovk restored the search-focus branch August 29, 2023 18:42
@hugovk

hugovk commented Aug 29, 2023

Copy link
Copy Markdown
Member Author

Re-opening as #135 didn't work out.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk hugovk mentioned this pull request Aug 29, 2023
Focus search box when pressing slash #153
Merged
@hugovk

hugovk commented Aug 29, 2023

Copy link
Copy Markdown
Member Author

Or the re-open button doesn't work after rebasing/force pushing, so here's a new PR: #153.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ezio-melotti ezio-melotti ezio-melotti left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Focus search box when pressing slash

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@hugovk @ezio-melotti
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.