[Webkit-unassigned] [Bug 238505] New: Default event target for keyboard events is different in HTML and XHTML documents

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 29 08:20:34 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=238505

            Bug ID: 238505
           Summary: Default event target for keyboard events is different
                    in HTML and XHTML documents
           Product: WebKit
           Version: Safari 15
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: robertknight at gmail.com

Created attachment 456025

  --> https://bugs.webkit.org/attachment.cgi?id=456025&action=review

HTML test case

When no element is focused in a document, the element to which keyboard events are dispatched is different in XHTML vs HTML documents.

Steps to reproduce:

1. Open attached test.html
2. Focus the document, press some keys and note the `target` property of events logged in the browser console
3. Repeat steps 1 and 2 with attached test.xhtml

Ideally the keyboard events would be fired at the same element in both HTML and XHTML documents.

In Safari and Chrome the keyboard events are fired at the body  element for HTML documents and the document element for XHTML documents. In Firefox the keyboard events are fired at the document body for both document types. 

For XHTML documents that do not have a body element, Firefox fires events at the document element instead, which seems like reasonable fallback behavior.

We encountered this issue when investigating a bug in our web app where a keyboard shortcut handler, installed on the document body, didn't work when the code was loaded in an XHTML document.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220329/c62e786b/attachment.htm>


More information about the webkit-unassigned mailing list