Bug 228802

Summary: REGRESSION (r280492): Clicking backspace on sign in fields results in deleting two characters instead of one
Product: WebKit Reporter: Dana Estra <dana.estra>
Component: WebCore Misc.Assignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, bdakin, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
For EWS none

Description Dana Estra 2021-08-04 15:25:09 PDT
REGRESSION (r280492): Clicking backspace on sign in fields results in deleting two characters instead of one
Comment 1 Dana Estra 2021-08-04 15:29:49 PDT
Created attachment 434942 [details]
Patch
Comment 2 Tim Horton 2021-08-04 15:43:29 PDT
Comment on attachment 434942 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        No tests yet.

The fact that this didn't break any tests is astounding; you should see if Wenson has any good ideas about how to test the software keyboard codepath (we may not have a good way, and no need for making one to block the regression fix).
Comment 3 Wenson Hsieh 2021-08-04 15:50:39 PDT
(In reply to Tim Horton from comment #2)
> Comment on attachment 434942 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434942&action=review
> 
> > Source/WebCore/ChangeLog:8
> > +        No tests yet.
> 
> The fact that this didn't break any tests is astounding; you should see if
> Wenson has any good ideas about how to test the software keyboard codepath
> (we may not have a good way, and no need for making one to block the
> regression fix).

The last time I looked into adding support for this, I did not find any straightforward way to achieve this (using API, SPI, or even IPI). That said, it has been several years since this investigation, so we should take another look at this!

(In the shorter term, perhaps it's also possible to write an API test that swizzles/mocks/calls directly into `WKContentView` to simulate pressing the delete key on the software keyboard on iOS).
Comment 4 Wenson Hsieh 2021-08-04 15:57:22 PDT
(In reply to Wenson Hsieh from comment #3)
> (In reply to Tim Horton from comment #2)
> > Comment on attachment 434942 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=434942&action=review
> > 
> > > Source/WebCore/ChangeLog:8
> > > +        No tests yet.
> > 
> > The fact that this didn't break any tests is astounding; you should see if
> > Wenson has any good ideas about how to test the software keyboard codepath
> > (we may not have a good way, and no need for making one to block the
> > regression fix).
> 
> The last time I looked into adding support for this, I did not find any
> straightforward way to achieve this (using API, SPI, or even IPI). That
> said, it has been several years since this investigation, so we should take
> another look at this!
> 
> (In the shorter term, perhaps it's also possible to write an API test that
> swizzles/mocks/calls directly into `WKContentView` to simulate pressing the
> delete key on the software keyboard on iOS).

From a quick debugging session on my iPhone, it looks like we might be able to grab the TIKeyboardLayout from the active UIKeyboardImpl, look up the frame (CGRect) of the corresponding key string, map that from input view coordinates into screen coordinates, and then synthesize HID events to tap the center of that rect.

I suppose any test that uses this mechanism would need to listen for DOM events (keyup) to know that the key press is finished.
Comment 5 Dana Estra 2021-08-04 16:07:03 PDT
Created attachment 434949 [details]
Patch
Comment 6 Wenson Hsieh 2021-08-04 16:08:54 PDT
rdar://81496530
Comment 7 EWS 2021-08-04 16:54:02 PDT
Committed r280671 (240276@main): <https://commits.webkit.org/240276@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434949 [details].
Comment 8 Wenson Hsieh 2021-08-04 17:56:44 PDT Comment hidden (obsolete)
Comment 9 Wenson Hsieh 2021-08-04 17:56:45 PDT Comment hidden (obsolete)
Comment 10 Wenson Hsieh 2021-08-04 17:57:36 PDT Comment hidden (obsolete)