-
Notifications
You must be signed in to change notification settings - Fork 16
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
Prevent triggering hideSearchWords
when closing the modal
#104
base: main
Are you sure you want to change the base?
Conversation
// Avoid triggering Sphinx's 'hideSearchWords' shortcut. | ||
e.stopPropagation(); | ||
removeSearchModal(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but now the modal isn't closed if the panel lost the focus (and hideSearchWords is triggered :/), was able to reproduce by clicking on the "white area" of the modal, but clicking on the search box gains the focus and escape works again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you'll need to add an event listener for something other than the input box. This key code event is only on the search_outer_input
element, where you likely also want to listen on search_outer
.
cbfbd80
to
bedc124
Compare
Docs should pass after #105 is merged, and you should be able to test this at https://readthedocs-sphinx-search--104.org.readthedocs.build/en/104/index.html?highlight=sphinx&rtd_search=press%20escape |
Could someone please rebase to check if it works now? |
Two things: - The scope of the event needs to be narrowed down (from document to just the modal). - We need to call stopPropagation so the event isn't triggered for the document object. Closes #103
bedc124
to
afb6a7a
Compare
This can be tested at https://readthedocs-sphinx-search--104.org.readthedocs.build/en/104/index.html?highlight=sphinx&rtd_search=press%20escape, but there is this small problem #104 (comment) |
Two things:
(from document to just the modal).
document object.
Closes #103