Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6850883ce88bda38eec2a026e7b7ab8d044097ea
      
https://github.com/WebKit/WebKit/commit/6850883ce88bda38eec2a026e7b7ab8d044097ea
  Author: Chris Dumez <[email protected]>
  Date:   2026-08-09 (Sun, 09 Aug 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-single-activation-behavior-expected.txt
    M Source/WebCore/dom/EventDispatcher.cpp
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/Node.h
    M Source/WebCore/html/HTMLAnchorElement.cpp
    M Source/WebCore/html/HTMLAnchorElement.h
    M Source/WebCore/html/HTMLButtonElement.cpp
    M Source/WebCore/html/HTMLButtonElement.h
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLInputElement.h
    M Source/WebCore/html/HTMLLabelElement.cpp
    M Source/WebCore/html/HTMLLabelElement.h
    M Source/WebCore/html/HTMLSummaryElement.cpp
    M Source/WebCore/html/HTMLSummaryElement.h

  Log Message:
  -----------
  Clicking an element nested inside a checkbox/radio wrongly activates the 
ancestor input
https://bugs.webkit.org/show_bug.cgi?id=321247

Reviewed by Darin Adler.

WebKit's legacy-pre-activation behavior (the checkbox/radio toggle that happens 
before
event dispatch) was applied to the first <input> found anywhere in the event 
path,
including an ancestor checkbox/radio. Per the DOM specification, 
legacy-pre-activation
behavior must only run on the event's activation target, which is the innermost 
node in
the event path that has activation behavior. So when an element with its own 
activation
behavior (e.g. a submit/reset <button>, an <a>/<area> link, a <summary>, or a
<label><button type=button>) is nested inside a checkbox/radio, that inner 
element is the
activation target and the ancestor input must not be toggled or activated.

Introduce a virtual Node::hasActivationBehavior() (matching the spec concept 
and Blink's
HasActivationBehavior), returning true for HTMLInputElement, HTMLButtonElement,
HTMLLabelElement, and HTMLSummaryElement, and isLink() for HTMLAnchorElement 
(and
HTMLAreaElement via inheritance). findInputElementInEventPath() now returns the 
innermost
node with activation behavior, and only when that node is an <input>; otherwise 
no legacy
pre-activation behavior runs.

This fixes 14 subtests in Event-dispatch-single-activation-behavior.html, 
including the 12
that already pass in both Chrome and Firefox. The remaining failures match the 
ones Chrome
and/or Firefox also fail.

No new tests, rebaselined existing WPT test.

* 
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-single-activation-behavior-expected.txt:
* Source/WebCore/dom/EventDispatcher.cpp:
(WebCore::findInputElementInEventPath):
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::hasActivationBehavior const):
* Source/WebCore/dom/Node.h:
* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isSystemPreviewLink):
* Source/WebCore/html/HTMLAnchorElement.h:
* Source/WebCore/html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::hasActivationBehavior const):
* Source/WebCore/html/HTMLButtonElement.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::hasActivationBehavior const):
* Source/WebCore/html/HTMLInputElement.h:
* Source/WebCore/html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::hasActivationBehavior const):
* Source/WebCore/html/HTMLLabelElement.h:
* Source/WebCore/html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::hasActivationBehavior const):
* Source/WebCore/html/HTMLSummaryElement.h:

Canonical link: https://commits.webkit.org/318853@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to