RESOLVED FIXED 167716
Dismiss HTML form validation popover when pressing Escape key
https://bugs.webkit.org/show_bug.cgi?id=167716
Summary Dismiss HTML form validation popover when pressing Escape key
Chris Dumez
Reported 2017-02-01 16:49:02 PST
Dismiss HTML form validation popover when pressing Escape key.
Attachments
Patch (7.26 KB, patch)
2017-02-01 17:02 PST, Chris Dumez
no flags
Archive of layout-test-results from ews100 for mac-elcapitan (1.01 MB, application/zip)
2017-02-01 18:05 PST, Build Bot
no flags
Archive of layout-test-results from ews116 for mac-elcapitan (1.76 MB, application/zip)
2017-02-01 18:14 PST, Build Bot
no flags
Patch (7.27 KB, patch)
2017-02-01 19:10 PST, Chris Dumez
no flags
Patch (7.31 KB, patch)
2017-02-02 09:34 PST, Chris Dumez
no flags
Patch (12.05 KB, patch)
2017-02-02 18:43 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-02-01 16:49:41 PST
Chris Dumez
Comment 2 2017-02-01 17:02:16 PST
Build Bot
Comment 3 2017-02-01 18:05:08 PST
Comment on attachment 300372 [details] Patch Attachment 300372 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2988735 New failing tests: fast/forms/validation-bubble-escape-key-dismiss.html
Build Bot
Comment 4 2017-02-01 18:05:12 PST
Created attachment 300381 [details] Archive of layout-test-results from ews100 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 5 2017-02-01 18:14:33 PST
Comment on attachment 300372 [details] Patch Attachment 300372 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2988736 New failing tests: fast/forms/validation-bubble-escape-key-dismiss.html
Build Bot
Comment 6 2017-02-01 18:14:36 PST
Created attachment 300383 [details] Archive of layout-test-results from ews116 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Chris Dumez
Comment 7 2017-02-01 19:10:31 PST
Chris Dumez
Comment 8 2017-02-02 09:34:38 PST
Tim Horton
Comment 9 2017-02-02 12:48:56 PST
Comment on attachment 300416 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300416&action=review > Source/WebKit/mac/WebView/WebFrameView.mm:1092 > +#if PLATFORM(MAC) Why Mac specific? Did we not implement for UIWebView? Seems like we would want this to work with a hardware keyboard on iOS. > Source/WebKit2/UIProcess/WebPageProxy.cpp:1989 > + if (event.key() == "Escape") Wonder if this should be plumbed the same way as escape-to-dismiss-spelling-suggestions or escape-to-exit-pointer-lock and whatnot. The fact that there aren't any other behaviors here makes me dubious that this is the right place for this.
Chris Dumez
Comment 10 2017-02-02 16:12:23 PST
Comment on attachment 300416 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300416&action=review >> Source/WebKit/mac/WebView/WebFrameView.mm:1092 >> +#if PLATFORM(MAC) > > Why Mac specific? Did we not implement for UIWebView? Seems like we would want this to work with a hardware keyboard on iOS. 1. This is not Form validation is not implemented on iOS / WK1. 2. kVK_Escape is only valid on Mac. >> Source/WebKit2/UIProcess/WebPageProxy.cpp:1989 >> + if (event.key() == "Escape") > > Wonder if this should be plumbed the same way as escape-to-dismiss-spelling-suggestions or escape-to-exit-pointer-lock and whatnot. The fact that there aren't any other behaviors here makes me dubious that this is the right place for this. I am not familiar with those. I'll take a look.
Chris Dumez
Comment 11 2017-02-02 18:43:51 PST
Simon Fraser (smfr)
Comment 12 2017-02-03 12:09:53 PST
Comment on attachment 300483 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300483&action=review > Source/WebCore/page/EventHandler.cpp:3063 > + if (initialKeyEvent.type() == PlatformEvent::KeyDown && initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) { > + if (auto* page = m_frame.page()) { > + if (auto* validationMessageClient = page->validationMessageClient()) > + validationMessageClient->hideAnyValidationMessage(); > + } > + } Should Escape dismiss any bubble, or only the one on the field that's focused? Also, does this work on iOS with a hardware keyboard?
Chris Dumez
Comment 13 2017-02-03 12:12:12 PST
(In reply to comment #12) > Comment on attachment 300483 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=300483&action=review > > > Source/WebCore/page/EventHandler.cpp:3063 > > + if (initialKeyEvent.type() == PlatformEvent::KeyDown && initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) { > > + if (auto* page = m_frame.page()) { > > + if (auto* validationMessageClient = page->validationMessageClient()) > > + validationMessageClient->hideAnyValidationMessage(); > > + } > > + } > > Should Escape dismiss any bubble, or only the one on the field that's > focused? There is always only one bubble visible so I don't think it matters. > > Also, does this work on iOS with a hardware keyboard? The code does not have anything Mac specific so I don't think why not. That said, I do not have such configuration to test.
Chris Dumez
Comment 14 2017-02-03 12:15:41 PST
(In reply to comment #13) > (In reply to comment #12) > > Comment on attachment 300483 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=300483&action=review > > > > > Source/WebCore/page/EventHandler.cpp:3063 > > > + if (initialKeyEvent.type() == PlatformEvent::KeyDown && initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) { > > > + if (auto* page = m_frame.page()) { > > > + if (auto* validationMessageClient = page->validationMessageClient()) > > > + validationMessageClient->hideAnyValidationMessage(); > > > + } > > > + } > > > > Should Escape dismiss any bubble, or only the one on the field that's > > focused? > > There is always only one bubble visible so I don't think it matters. Also, if a validation bubble is visible, then it means its associated field is focused. Doing anything (like focusing another field) would make the bubble go away. > > > > > Also, does this work on iOS with a hardware keyboard? > > The code does not have anything Mac specific so I don't think why not. That > said, I do not have such configuration to test.
Chris Dumez
Comment 15 2017-02-03 12:42:37 PST
(In reply to comment #13) > (In reply to comment #12) > > Comment on attachment 300483 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=300483&action=review > > > > > Source/WebCore/page/EventHandler.cpp:3063 > > > + if (initialKeyEvent.type() == PlatformEvent::KeyDown && initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) { > > > + if (auto* page = m_frame.page()) { > > > + if (auto* validationMessageClient = page->validationMessageClient()) > > > + validationMessageClient->hideAnyValidationMessage(); > > > + } > > > + } > > > > Should Escape dismiss any bubble, or only the one on the field that's > > focused? > > There is always only one bubble visible so I don't think it matters. > > > > > Also, does this work on iOS with a hardware keyboard? > > The code does not have anything Mac specific so I don't think why not. That > said, I do not have such configuration to test. Oh, I have the right configuration now, I'll confirm it works on iOS shortly.
Chris Dumez
Comment 16 2017-02-03 14:19:48 PST
Comment on attachment 300483 [details] Patch Clearing flags on attachment: 300483 Committed r211653: <http://trac.webkit.org/changeset/211653>
Chris Dumez
Comment 17 2017-02-03 14:19:53 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.