Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent mistakenly opening a search box in some situations #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jakseb
Copy link

@jakseb jakseb commented Dec 12, 2020

Below some test cases to demonstrate the wrong behavior that each commit fixes.

Improve identifying keys as character keys

Press 2 on the numeric keypad while NumLock is off (it is used as an arrow key).

Deactivate on pages with design mode enabled

https://www-archive.mozilla.org/editor/midasdemo/.

Fix input field detection in XHTML documents

Try to enter a search query at https://golem.ph.utexas.edu/cgi-bin/MT-3.0/mt-search.cgi.

The `.key != .code` approach leads to wrongly capturing some unusual
special keys as well as numpad keys used in non-numeric mode, and
opening a search bar with the key name filled in. Non-character key
names seem to consist of alphanumeric ASCII characters, so checking for
that might be a more reliable heuristic.
`designMode` does not affect `isContentEditable` in Firefox, so the
former must be checked separately.
`tagName` is uppercase in HTML and lowercase in XHTML mode. Use
`localName`, which is always lowercase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant