Bug 228845

Summary: preventDefault() on keydown event should prevent dialog cancelation from happening
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: DOMAssignee: Tim Nguyen (:ntim) <ntim>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, esprehn+autocc, ews-watchlist, gyuyoung.kim, koivisto, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 229475    
Bug Blocks: 84635    
Attachments:
Description Flags
Patch koivisto: review+

Description Tim Nguyen (:ntim) 2021-08-05 14:56:44 PDT
This is covered by dialog-keydown-preventDefault.html: https://github.com/web-platform-tests/wpt/blob/master/html/semantics/interactive-elements/the-dialog-element/dialog-keydown-preventDefault.html

Not sure if there are any other events that should also prevent dialog cancelation, but they should be covered by tests as well if so.
Comment 1 Radar WebKit Bug Importer 2021-08-11 13:40:44 PDT
<rdar://problem/81811203>
Comment 2 Tim Nguyen (:ntim) 2021-08-24 03:36:54 PDT
Created attachment 436273 [details]
Patch
Comment 3 Tim Nguyen (:ntim) 2021-08-24 05:57:54 PDT
Committed r281492 (240866@main): <https://commits.webkit.org/240866@main>
Comment 4 Ryosuke Niwa 2021-08-24 11:01:55 PDT
Comment on attachment 436273 [details]
Patch

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

> Source/WebCore/page/EventHandler.cpp:3804
> +            if (auto* activeModalDialog = m_frame.document()->activeModalDialog())

Use RefPtr

> Source/WebCore/page/EventHandler.cpp:3812
> +

Why are we adding a blank line here?