Dismiss HTML form validation popover when pressing Escape key.
<rdar://problem/29872943>
Created attachment 300372 [details] Patch
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
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
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
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
Created attachment 300385 [details] Patch
Created attachment 300416 [details] Patch
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.
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.
Created attachment 300483 [details] Patch
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?
(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.
(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.
(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.
Comment on attachment 300483 [details] Patch Clearing flags on attachment: 300483 Committed r211653: <http://trac.webkit.org/changeset/211653>
All reviewed patches have been landed. Closing bug.