LibWeb: Fire keypress event for Enter, Shift+Enter, and Ctrl+Enter keys #3353
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.
For web compat and interop with other engines, this change makes us fire
keypress
events for the Enter key and for the combination of the Enter key with the Shift or Ctrl keys — despite the fact the UI Events spec states at https://w3c.github.io/uievents/#event-type-keypress it must be fired “if and only if that key normally produces a character value”.See w3c/uievents#183 (comment) and w3c/uievents#266 (comment).
Otherwise, without this change, Ladybird won’t work as expected in (the likely very many) existing web applications that use the
keypress
events to check for Enter key presses.For example, without this change, Ladybird doesn’t work as expected when trying to send messages in the https://thelounge.chat/ web-based IRC client (which is where I first noticed this problem), and generally perhaps in many Vue-based apps — because the Lounge is a Vue-based app, and https://github.com/search?q=%22%40keypress.enter%22+language%3AVue&type=code&l=Vue seems to indicate there’s a whole lotta other existing Vue code out there in the wild that’s doing stuff with
@keypress.enter
…