Fix detection of modifiers on Firefox in textarea or input and modifiers sent through virtual keycodes #986
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More Firefox bugs/inconsistencies yay!
For KeyboardEvent, when modifiers are pressed on Firefox without any other keys and the focus is in a textarea or input, the keydown event does not contain the last pressed modifier as event.{modifier}. This also occurs when modifiers are sent through virtual keycodes (often the result of software keyboard remapping).
Chrome and Firefox (outside of a textarea or input) do report the modifier in both the event.{modifier} and the event.code so we must check if the modifier has already been added to not duplicate it.
The textarea and input part of this usually doesn't matter (we already don't allow scanning without mousemove in an input or textarea) but it makes it very annoying to set up modifier only keybinds for shortcuts. You had to press more keys than were actually being set to get it to work correctly which is terrible UX and I'm sure some users wouldn't figure this out and just give up thinking we didn't support that.