Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Conversation

@stsewd
Copy link
Member

@stsewd stsewd commented Mar 7, 2022

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

// Avoid triggering Sphinx's 'hideSearchWords' shortcut.
e.stopPropagation();
removeSearchModal();
}
Copy link
Member Author

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.

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.

@stsewd stsewd force-pushed the prevent-calling-sphinxs-hide-search branch from cbfbd80 to bedc124 Compare March 7, 2022 19:59
@stsewd stsewd mentioned this pull request Mar 7, 2022
@stsewd
Copy link
Member Author

stsewd commented Mar 7, 2022

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

@stsewd stsewd requested a review from a team March 7, 2022 22:58
@mgeier
Copy link

mgeier commented Apr 5, 2022

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
@stsewd stsewd force-pushed the prevent-calling-sphinxs-hide-search branch from bedc124 to afb6a7a Compare April 5, 2022 20:11
@stsewd
Copy link
Member Author

stsewd commented Apr 5, 2022

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants