Bug 149054 - keydown event doesn't fire on iOS when arrow keys pressed on external keyboard
Summary: keydown event doesn't fire on iOS when arrow keys pressed on external keyboard
Status: RESOLVED MOVED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari 9
Hardware: iPhone / iPad iOS 8.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 190571
  Show dependency treegraph
 
Reported: 2015-09-10 18:32 PDT by Steve
Modified: 2019-06-05 09:45 PDT (History)
22 users (show)

See Also:


Attachments
Repro.html (1.09 KB, text/html)
2015-09-10 18:32 PDT, Steve
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve 2015-09-10 18:32:40 PDT
Created attachment 260981 [details]
Repro.html

Steps to Reproduce:

1. Connect an external keyboard to an iPad Simulator: Hardware > Keyboard > Connect Hardware Keyboard
2. Open attached file in Safari on an iPad Simulator
3. Tap into the editable region
4. Press the arrow keys on the keyboard
5. Notice the keydown event doesn't fire

These instructions are specific to the iOS simulator, but I assume the same steps apply when connecting a physical keyboard to a real iPad?
Comment 1 Bem Jones-Bey 2015-09-11 10:36:25 PDT
I have confirmed that real hardware (iPad Air 2, bluetooth keyboard) exhibits the same behavior on iOS 8.4.1.
Comment 2 Radar WebKit Bug Importer 2015-09-11 10:58:34 PDT
<rdar://problem/22663985>
Comment 3 Vince 2016-02-15 13:56:34 PST
I can confirm that this is still an issue on an iPad Mini FE276LL/A running iOS 9.2 (13C75), with a previous generation bluetooth Apple Wireless Keyboard.

More specifically, if NO control has focus, no keydown and no keyup events fire at all.

However, if a control DOES has focus, keydown and keyup events do fire, but the keyIdentifier is "Unidentified", and keyCode is 0 (the target is correct, however).

This makes it impossible to develop a web app that responds correctly to navigation using a bluetooth keyboard on iOS.
Comment 4 Ken Rimple 2016-06-10 06:50:29 PDT
Would be a huge benefit to the iPad community if arrow key events fired. That explains the lack of support by sites like Cloud9, plnkr, etc...  I do a lot of web development in those IDEs to teach people and to brainstorm when I'm not at my computer so it would be awesome if the team got this in and it made its way to IOS.
Comment 5 pirijan 2016-08-15 13:45:54 PDT
(In reply to comment #4)
> Would be a huge benefit to the iPad community if arrow key events fired.
> That explains the lack of support by sites like Cloud9, plnkr, etc...  I do
> a lot of web development in those IDEs to teach people and to brainstorm
> when I'm not at my computer so it would be awesome if the team got this in
> and it made its way to IOS.

+1
Comment 6 Willem L. Middelkoop 2018-01-30 22:32:46 PST
Workaround is possible:
- make sure some element has focus (so that key events do fire)
- event.keyCode will be 0 (which is non-desirable)
- however, event.key will have a value "UIKeyInputUpArrow", "UIKeyInputDownArrow", "UIKeyInputLeftArrow" or "UIKeyInputRightArrow"

I have confirmed this to work on iPad (in combination with hardware keyboard, type cover and bluetooth magic keyboard).
Comment 7 anami 2018-05-11 07:51:20 PDT
After rereading the last comment - I have realised it was not a JavaScript workaround. 

Verified with iPad mini 2 running iOS 11.3.1

In addition to the arrow keys - the modifier (CTRL, CMD, ALT, SHIFT) keys are not detected also. 
So things like going to the beginning of the line or starting a selection is not possible to detect. 

It would be nice to add the modifier keys along with the cursor key events and if possible as their own distinct key press events. 

Please make this into webKit for iOS.
Comment 8 Josué Zatarain 2018-09-04 10:22:21 PDT
Was this ever reviewed?
Comment 9 Josué Zatarain 2018-09-05 07:44:53 PDT
I just tested in ios 11.4.1 and keydown, keyup, input, don't get triggered by the arrows.
Comment 10 Josué Zatarain 2018-09-05 07:47:18 PDT
Also, keypress.
Comment 11 Josué Zatarain 2018-09-05 08:20:41 PDT
If you press enter, in the keyup event, keycode comes as 0, and the originalEvent object has code: "Unidentified".
It comes okay during a keydown event.
Comment 12 Jochen H. Schmidt 2018-10-21 01:24:40 PDT
Yes still the same behaviour. It is the main blocker for online IDE and code editor services like codesandbox.io, repl.it. Particularily Monaco the editor component of Visual Studio code does not work on the iPad because of this.
Comment 13 Eric Rabil 2018-11-20 12:08:41 PST
Has there been any update on this issue? No updates from the team in three years on such a glaring oversight is quite disturbing.
Comment 14 Daniel Bates 2018-11-20 12:42:42 PST
(In reply to Eric Rabil from comment #13)
> Has there been any update on this issue? No updates from the team in three
> years on such a glaring oversight is quite disturbing.

This needs to be fixed in UIKit.
Comment 15 Tim Horton 2018-11-26 09:48:27 PST
Not a WebKit bug; please file a duplicate at bugreport.apple.com if you want to track this (but it's already tracked by <rdar://problem/22663985> as mentioned above).
Comment 16 Daniel Bates 2018-12-11 19:50:18 PST
(In reply to Tim Horton from comment #15)
> Not a WebKit bug; please file a duplicate at bugreport.apple.com if you want
> to track this (but it's already tracked by <rdar://problem/22663985> as
> mentioned above).

For completeness, the UIKit bug was fixed in <rdar://problem/44929845>.
Comment 17 Eric Rabil 2018-12-21 10:15:15 PST
(In reply to Daniel Bates from comment #16)
> (In reply to Tim Horton from comment #15)
> > Not a WebKit bug; please file a duplicate at bugreport.apple.com if you want
> > to track this (but it's already tracked by <rdar://problem/22663985> as
> > mentioned above).
> 
> For completeness, the UIKit bug was fixed in <rdar://problem/44929845>.

I am now able to detect the arrow events in most elements (12.1.3b2), however <textarea> among a few other input elements still do not fire arrow events as expected.
Comment 18 Vlad Frolov 2019-03-27 01:34:40 PDT
The issue is still present in iOS 12.2 https://github.com/Microsoft/monaco-editor/issues/293
Comment 19 Chris Dumez 2019-03-27 08:43:45 PDT
(In reply to Vlad Frolov from comment #18)
> The issue is still present in iOS 12.2
> https://github.com/Microsoft/monaco-editor/issues/293

This is correct, the fix did not ship in iOS 12.2. We cannot comment on when a particular fix will ship to customers.
Comment 20 Brent Fulgham 2019-06-05 09:40:59 PDT
(In reply to Chris Dumez from comment #19)
> (In reply to Vlad Frolov from comment #18)
> > The issue is still present in iOS 12.2
> > https://github.com/Microsoft/monaco-editor/issues/293
> 
> This is correct, the fix did not ship in iOS 12.2. We cannot comment on when
> a particular fix will ship to customers.

We do believe that this issue is fixed in the iOS 13 developer seed. Please do try on that platform and let us know if it resolves the issue.
Comment 21 Eric Rabil 2019-06-05 09:45:30 PDT
(In reply to Brent Fulgham from comment #20)
> 
> We do believe that this issue is fixed in the iOS 13 developer seed. Please
> do try on that platform and let us know if it resolves the issue.

My iPad Pro 2nd Gen on iOS 13b1 has functioning arrow keys on Monaco editors that previously did not work :)