Rollup merge of #85438 - GuillaumeGomez:fix-escape-handling, r=jsha
Fix escape handling Currently, when we press Escape while on the search results, nothing is happening, this PR fixes it. More information: it's because in case the element doesn't exist, `hasClass` will return `null`, which coerces into `false` with the `!` comparison operator. But even if it returned `false`, it would still be an issue because if the element doesn't exist, it means it's hidden so in this case it's just as good, hence the additional check I added. r? ``@jsha``
This commit is contained in:
commit
6cfcbf7d03
2 changed files with 29 additions and 2 deletions
|
|
@ -425,9 +425,9 @@ function hideThemeButtonState() {
|
|||
function handleEscape(ev) {
|
||||
var help = getHelpElement(false);
|
||||
var search = searchState.outputElement();
|
||||
if (!hasClass(help, "hidden")) {
|
||||
if (help && !hasClass(help, "hidden")) {
|
||||
displayHelp(false, ev, help);
|
||||
} else if (!hasClass(search, "hidden")) {
|
||||
} else if (search && !hasClass(search, "hidden")) {
|
||||
searchState.clearInputTimeout();
|
||||
ev.preventDefault();
|
||||
searchState.hideResults(search);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue