Ctrl + Enter should cause keypress event even after fixing bug 968056

RESOLVED FIXED in Firefox 60

Status

()

enhancement
P2
normal
RESOLVED FIXED
2 years ago
5 months ago

People

(Reporter: masayuki, Assigned: masayuki)

Tracking

Trunk
mozilla60
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox60 fixed)

Details

Attachments

(1 attachment)

On the other browsers, it depends on the platform when Enter key causes keypress event. I think that basically, we shouldn't fire keypress event for Enter key unless it causes breaking line in <textarea> or contenteditable element. (Especially, even Chrome fires keypress event for Enter key with some modifiers, it doesn't modify both editors.)

However, for compatibility, we should keep dispatching keypress event for Ctrl + Enter since Ctrl + Enter causes keypress event on any browsers with any platforms. I believe that we don't need to emulate inconsistency between platforms of Chrome.
Priority: -- → P2
Comment on attachment 8951524 [details]
Bug 1438133 - Ctrl + Enter should cause keypress event even though the key combination doesn't input any character

https://reviewboard.mozilla.org/r/220822/#review227048

::: widget/TextEvents.h:255
(Diff revision 1)
>                             MODIFIER_META |
>                             MODIFIER_OS));
>    }
>  
> +  /**
> +   * ShouldKeyPressEventBeFiredOnContent() should be called only when the

This is inconsistent with the actual method name.
I think using ShouldKeyPressEventBeFiredOnContent as the method name would be good.

::: widget/TextEvents.h:266
(Diff revision 1)
> +    MOZ_DIAGNOSTIC_ASSERT(mMessage == eKeyPress);
> +    if (IsInputtingText() || IsInputtingLineBreak()) {
> +      return true;
> +    }
> +    // Ctrl + Enter won't cause actual input in our editor.
> +    // However, the other browsers fires keypress event in any platforms.

s/fires/fire/

::: widget/TextEvents.h:268
(Diff revision 1)
> +      return true;
> +    }
> +    // Ctrl + Enter won't cause actual input in our editor.
> +    // However, the other browsers fires keypress event in any platforms.
> +    // So, for compatibility with them, we should fire keypress event for
> +    // Ctrl + Enter too.

Since this is really odd behavior, could you file a spec bug to define this there too.
Attachment #8951524 - Flags: review?(bugs) → review+
Comment on attachment 8951524 [details]
Bug 1438133 - Ctrl + Enter should cause keypress event even though the key combination doesn't input any character

https://reviewboard.mozilla.org/r/220822/#review227048

> Since this is really odd behavior, could you file a spec bug to define this there too.

Filed: https://github.com/w3c/uievents/issues/183
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/cb4185c40f3d
Ctrl + Enter should cause keypress event even though the key combination doesn't input any character r=smaug
https://hg.mozilla.org/mozilla-central/rev/cb4185c40f3d
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.