emersonbottero / vitepress-plugin-search

Provide local search to your documentation site.
MIT License
238 stars 30 forks source link

[feature request] If input form is empty, press esc key to hide search window #59

Closed mark9804 closed 1 year ago

mark9804 commented 1 year ago

Description

As the following gif showed, the current action for Esc binds to "Clear input" action.

If the input box is already empty, pressing Esc has no effect.

Requested feature

When Esc is pressed, additional logic will be executed to examine if the current search text is empty. If true, search modal will be hidden.

hideSearchModal() if ('' !== search_text) else clearSearchText()