1
0
Fork 0
firefox/browser/extensions/webcompat/injections/js/bug1846742-microsoft.com-search-key-fix.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

23 lines
850 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* www.microsoft.com - Pressing enter on search suggestions does nothing
*
* When pressing enter on a search suggestion, nothing happens in Firefox
* due to key-event interop issues. We listen for enter keypresses and
* click the element as a work-around.
*/
console.info(
"A simulated click is issued on search suggestions when enter is pressed on them for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1846742 for details."
);
document.addEventListener("keydown", ({ target, key }) => {
if (key == "Enter" && target.matches(".m-auto-suggest a.f-product")) {
target.click();
}
});