Bug 189389

Summary: [iOS] Arrow keys do not dispatch DOM events to non-editable elements
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebCore Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, jeremyj-wk, jonlee, megan_gardner, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar, PlatformOnly
Version: WebKit Local Build   
Hardware: iPhone / iPad   
OS: iOS 11   
URL: https://www.icloud.com
See Also: https://bugs.webkit.org/show_bug.cgi?id=189388
Bug Depends on: 189381, 189432    
Bug Blocks: 190571    
Attachments:
Description Flags
Patch
none
To land after landing bug #189432 none

Description Daniel Bates 2018-09-06 17:46:12 PDT
Pressing the arrow keys on a hardware keyboard in a focused text field does not dispatch DOM keyboard events. I observed this today on icloud.com. Here are the steps I performed:

1. Open an iPad simulator instance.
2. Visit https://www.icloud.com.
3. Tap the share button. Then tap Request Desktop Site from the share sheet.
4. Sign in to iCloud.
5. Tap Pages.
6. Tap the + icon at the top of the page to open the template chooser.
7. Press the right arrow key on the keyboard.

Then nothing happens. But the Blank Landscape template should have been selected (visually indicated by having an orange outline wrapped around it).
Comment 1 Daniel Bates 2018-09-06 18:06:48 PDT
Created attachment 349101 [details]
Patch
Comment 2 Daniel Bates 2018-09-06 18:07:36 PDT
We will need to fix bug #189388 in order to be able to write a test.
Comment 3 Simon Fraser (smfr) 2018-09-06 19:03:16 PDT
Comment on attachment 349101 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349101&action=review

> Source/WebCore/ChangeLog:16
> +        Unfortunately I ran into <https://bugs.webkit.org/show_bug.cgi?id=189388> and hence could
> +        not write a test for this change.

Should we fix that first so we can land with tests?

> Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm:174
> +        return "Unidentified"_s;

That's a bit weird to have in production code. Maybe return empty string?
Comment 4 Daniel Bates 2018-09-07 14:47:12 PDT
There is a related issue with regards to arrow keys and editable elements. See bug #189388.
Comment 5 Daniel Bates 2018-09-07 14:49:42 PDT
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 349101 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=349101&action=review
> 
> > Source/WebCore/ChangeLog:16
> > +        Unfortunately I ran into <https://bugs.webkit.org/show_bug.cgi?id=189388> and hence could
> > +        not write a test for this change.
> 
> Should we fix that first so we can land with tests?
> 

Will fix this in bug #189432 and update this patch to include updated expected results for the test included in the patch for bug #189432.

> > Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm:174
> > +        return "Unidentified"_s;
> 
> That's a bit weird to have in production code. Maybe return empty string?

This is the correct behavior by <https://www.w3.org/TR/uievents-key/#key-Unidentified>.
Comment 6 Daniel Bates 2018-09-07 15:03:31 PDT
Created attachment 349200 [details]
To land after landing bug #189432
Comment 7 Daniel Bates 2018-09-10 14:02:58 PDT
Committed r235860: <https://trac.webkit.org/changeset/235860>
Comment 8 Radar WebKit Bug Importer 2018-09-10 14:03:39 PDT
<rdar://problem/44316290>