blur on input elements when Esc pressed

jh-changes
Shin'ya Ueoka 7 years ago
parent 6c01283973
commit 1a21e548d9
  1. 3
      src/content/index.js

@ -63,6 +63,9 @@ window.addEventListener('keypress', (e) => {
if (e.target instanceof HTMLInputElement || if (e.target instanceof HTMLInputElement ||
e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLTextAreaElement ||
e.target instanceof HTMLSelectElement) { e.target instanceof HTMLSelectElement) {
if (e.key === 'Escape' && e.target.blur) {
e.target.blur();
}
return; return;
} }
browser.runtime.sendMessage({ browser.runtime.sendMessage({