Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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

@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 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.

None yet

3 participants