`altKey` of `keypress` event is always false on macOS
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
People
(Reporter: adam.winer, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome, parity-safari)
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b4) Gecko/20050721 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b4) Gecko/20050721 Firefox/1.0+
In the following HTML snippet:
<input type="text" onkeypress="alert('alt? ' + event.altKey)">
... entering the field and hitting the "alt-A" keystroke (aka option-A) on the
Mac just shows "alt? false". This correctly shows "alt? true" on Safari. It
does work for onkeydown and onkeyup.
Reproducible: Always
Steps to Reproduce:
1. Add the following to a document:
<input type="text" onkeypress="alert('alt? ' + event.altKey)">
2. Enter the field.
3. press option-a
Actual Results:
You see "alt? false" in an alert.
Expected Results:
You should have seen "alt? true in an alert.
MacOS 10.4.2
Repros in Firefox 1.0.3 and Deerpark alpha 2
Comment 1•19 years ago
|
||
see bug 300678 : that piece of JS code correctly determines the state of the altkey (using onkeydown)
Comment 2•19 years ago
|
||
Mac widgetry issue.
Comment 3•19 years ago
|
||
it seems like one must use alt+(ctrl|cmd) to get a "true" value here. for keycode 18 (alt) in about:config prefs. only the ctrl+alt variant works, though. there must be some way to allow plain old (alt) as a modifier key...
Comment 6•19 years ago
|
||
(In reply to comment #5) > Why? It doesn't seem very related to me... > yeah, maybe not. i assumed that fixing bug 300678 would also take care of this one, and that was just marked as a dupe of 44259, ergo...
If it's not a dupe, then it's definitely a bug. -->Cocoa
| Assignee | ||
Comment 9•5 years ago
|
||
Moving all keyboard/IME handling bugs to DOM: UI Events & Focus Handling component.
| Assignee | ||
Comment 10•5 years ago
|
||
Indeed, this could cause web-compat issue. I think that we can fix this bug with bug 1596916 because we need new flag in WidgetKeyboardEvent which indicate whether the eKeyPress event should introduce a character or not.
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 11•5 years ago
|
||
The other browsers on macOS set altKey to true of keypress
events even when they introduce a chracter so that we should
follow same behavior for web-compat.
WidgetKeyboardEvent::IsInputtingText() has already ignore
MODIFIER_ALT flag only on macOS.
https://searchfox.org/mozilla-central/rev/4d9cd186767978a99dafe77eb536a9525980e118/widget/TextEvents.h#257-261
So, only IMEInputHandler stop the hack only for Alt state.
| Assignee | ||
Comment 12•5 years ago
|
||
I think that we should put it off to change this our traditional behavior even though the new behavior is same as Blink/WebKit until COVID-19 calms down because we've experienced a lot of breakage with this kind of changes. What do you think?
Comment 13•5 years ago
|
||
Sounds reasonable.
In theory we could land the patch with a pref and enable the pref only on Nightly.
But this is a really old bug, so probably not hurry to land anything. Perhaps we want a meta bug to track which patches need to land later?
Comment 14•5 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #13)
Sounds reasonable.
In theory we could land the patch with a pref and enable the pref only on Nightly.But this is a really old bug, so probably not hurry to land anything. Perhaps we want a meta bug to track which patches need to land later?
Agreed to not hurry! Thank you for raising the concern, Masayuki.
| Assignee | ||
Comment 16•3 years ago
|
||
Smaug: I think that it's fine to land this since a lot of big changes have been landed in various area of Gecko. WDYT?
Comment 17•2 years ago
•
|
||
Would it make sense to add a pref and enable first on Nightly? (sorry about massive delay in responding)
Updated•2 years ago
|
Comment 18•2 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:masayuki, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.
| Assignee | ||
Comment 19•2 years ago
|
||
I don't have much time to land this because I assume that this would cause trouble in some web apps (at least, I need to investigate how it causes).
| Assignee | ||
Updated•2 years ago
|
Description
•