Refined-github: `Shift+O` shouldn't work when writing inside an editable element

Created on 13 Jun 2019  路  4Comments  路  Source: sindresorhus/refined-github

GitHub ~recently added a list of similar issues when opening a new issue:


Screen Shot 2019-06-13 at 01 58 35


The problem is that whenever I type an uppercased O, i.e. Shift+O is pressed, the first of those listed issues is opened in a new tab.

Shift+O should be ignored when an editable element has the focus.

bug good first issue help wanted

All 4 comments

The listener needs to detect and exclude events in fields, e.g. via if event.target.matches('input, textarea') return or target instanceof HTMLInputElement/HTMLTextAreaElement

Some other feature might already have this code, so it might be worth turning into a function and adding it dom-utils.ts

The listener needs to detect and exclude events in fields, e.g. via if event.target.matches('input, textarea') return or target instanceof HTMLInputTextarea

A more reliable implementation of this is available here: https://github.com/kenwheeler/cash/blob/8694089659167f84a106467881991e52b2fd68f1/src/core/matches.ts#L4-L10

Also the selector should probably be input, textarea, [contenteditable].

A more reliable implementation of this is available here:

Only the latest chrome and Firefox are supported so no polyfills necessary.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juliocanares picture juliocanares  路  3Comments

hkdobrev picture hkdobrev  路  3Comments

vanniktech picture vanniktech  路  3Comments

yakov116 picture yakov116  路  3Comments

hkdobrev picture hkdobrev  路  3Comments