Skip to content

Fix search dialog dismissal on Escape and click-away - #10

Merged
timkpaine merged 1 commit into
mainfrom
tkp/fix-search-dialog-escape
Sep 8, 2026
Merged

Fix search dialog dismissal on Escape and click-away#10
timkpaine merged 1 commit into
mainfrom
tkp/fix-search-dialog-escape

Conversation

@timkpaine

@timkpaine timkpaine commented Sep 8, 2026

Copy link
Copy Markdown
Member

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 the Esc hint 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 = False and 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

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup
  • CI / build configuration
  • Other (describe below)

Checklist

  • Linting passes (make lint)
  • Tests pass (make test)
  • New tests added for new functionality
  • Documentation updated (if applicable)
  • Changelog / version bump (if applicable)

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>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results

45 tests  +1   45 ✅ +1   2s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 99a53a2. ± Comparison against base commit 2e86085.

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.04%. Comparing base (2e86085) to head (99a53a2).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timkpaine
timkpaine merged commit 5a09ba1 into main Sep 8, 2026
4 checks passed
@timkpaine
timkpaine deleted the tkp/fix-search-dialog-escape branch September 8, 2026 20:09
@timkpaine timkpaine changed the title Close the search dialog on the first Escape Fix search dialog dismissal on Escape and click-away Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant