diff options
| author | Phil Crosby | 2009-12-31 02:01:04 -0500 |
|---|---|---|
| committer | Phil Crosby | 2009-12-31 02:01:04 -0500 |
| commit | a8b0a87252fde722eae1672409bee30bf79c1bbb (patch) | |
| tree | 33c1043b3f90c16c4d4a86d9bca9ccc532ac1505 | |
| parent | 7890bf8e6be5a7855066ae964e827545d8eb5423 (diff) | |
| download | vimium-a8b0a87252fde722eae1672409bee30bf79c1bbb.tar.bz2 | |
Enter insert mode when any form element is focused. Fixes #36 and #27.
| -rw-r--r-- | vimiumFrontend.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index e3c0c7de..d3345053 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -289,9 +289,15 @@ function onBlurCapturePhase(event) { */ function isFocusable(element) { return isInputOrText(element) || element.tagName == "EMBED"; } +/* + * Input or text elements are considered focusable and able to receieve their own keyboard events, + * and will enter enter mode if focused. + * Note: we used to discriminate for text-only inputs, but this is not accurate since all input fields + * can be controlled via the keyboard, particuarlly SELECT combo boxes. + */ function isInputOrText(target) { - return ((target.tagName == "INPUT" && (target.type == "text" || target.type == "password")) || - target.tagName == "TEXTAREA"); + var focusableInputs = ["input", "textarea", "select", "button"]; + return focusableInputs.indexOf(target.tagName.toLowerCase()) >= 0; } function enterInsertMode() { |
