Fix search dialog dismissal on Escape and click-away - #10
Merged
Conversation
Chrome's `<input type=search>` consumes the first Escape to clear the field, so closing the dialog took two presses despite the `Esc` hint. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10 +/- ##
==========================================
+ Coverage 91.99% 92.04% +0.05%
==========================================
Files 6 6
Lines 462 465 +3
Branches 61 61
==========================================
+ Hits 425 428 +3
Misses 16 16
Partials 21 21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Two fixes to the theme's search dialog.
Escape needed two presses. Chrome's
<input type=search>consumes the first Escape to clear the field, so dismissing took two presses despite theEschint next to the input. The dialog now closes on Escape explicitly.Selecting the query dismissed the dialog. A click whose press landed inside the panel still targets the dialog on release, so dragging past the field's edge to select the query closed it and discarded the search. Click-away now requires the press to have landed on the backdrop too.
The theme is unaffected by the focus trap fixed in python-project-templates/sphinx-searchlite#7, since it sets
searchlite_ui = Falseand opens its own dialog from buttons rather than adopting a search field. It does pick up the result-url fix from that PR, which repairs search results on pages below the documentation root.Checked in Chromium against the built docs at the root and at
docs/src/theme-options.html, covering the backdrop, the area below the panel, clicks inside the panel, and selections dragged out of it.Type of Change
Checklist
make lint)make test)