Prevent triggering hideSearchWords when closing the modal#104
Prevent triggering hideSearchWords when closing the modal#104
hideSearchWords when closing the modal#104Conversation
| // Avoid triggering Sphinx's 'hideSearchWords' shortcut. | ||
| e.stopPropagation(); | ||
| removeSearchModal(); | ||
| } |
There was a problem hiding this comment.
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.
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