WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 22261
267449
`document.activeElement` for an `onclick` on a `<input type=checkbox>` returns HTMLBodyElement instead of HTMLInputElement
https://bugs.webkit.org/show_bug.cgi?id=267449
Summary
`document.activeElement` for an `onclick` on a `<input type=checkbox>` return...
Karl Dubost
Reported
2024-01-12 01:53:00 PST
`document.activeElement` for an `onclick` on a `<input type=checkbox>` returns: * HTMLBodyElement on Safari * HTMLInputElement on Chrome, Firefox See
https://codepen.io/webcompat/pen/zYbKgGd
<input type="checkbox" id="check" onclick="logme(this)"> <div id="log"></div> var check = document.querySelector("#check"); var log = document.querySelector("#log"); function logme(element) { log.textContent += document.activeElement; } log.textContent = check; I will upload a proper test case tomorrow if I can't find a WPT test for it.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2024-01-12 01:53:14 PST
<
rdar://problem/120894916
>
Karl Dubost
Comment 2
2024-01-12 03:39:13 PST
https://html.spec.whatwg.org/multipage/interaction.html#dom-documentorshadowroot-activeelement-dev
Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document. For the purposes of this API, when a child navigable is focused, its container is focused within its parent's active document. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document. Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not.
Karl Dubost
Comment 3
2024-01-14 20:54:07 PST
This behavior creates a webcompat issue for ceac.state.gov website on Safari. I should open a bug on
https://webcompat.com/
Karl Dubost
Comment 4
2024-01-16 23:59:30 PST
MacOS Platform behaves differently than windows with regards to focus on Form Elements. This is a conscious decision to keep. I'm closing this as a duplicate of
Bug 193478
ceac.state.gov was a regression introduced by a modification of the Quirks which was handling this. *** This bug has been marked as a duplicate of
bug 193478
***
Karl Dubost
Comment 5
2024-11-17 20:50:48 PST
*** This bug has been marked as a duplicate of
bug 22261
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug