[webkit-changes] [WebKit/WebKit] ff42f7: Cannot pick US state in dropdown on vote.gov

Aditya Keerthi noreply at github.com
Fri Jan 19 15:58:06 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff42f766814691356f3b339275ae5164654368a2
      https://github.com/WebKit/WebKit/commit/ff42f766814691356f3b339275ae5164654368a2
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-01-19 (Fri, 19 Jan 2024)

  Changed paths:
    M Source/WebCore/html/HTMLAnchorElement.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h

  Log Message:
  -----------
  Cannot pick US state in dropdown on vote.gov
https://bugs.webkit.org/show_bug.cgi?id=267779
rdar://121240580

Reviewed by Wenson Hsieh.

vote.gov uses a custom state selection dropdown, which is a `<div>` containing
multiple anchor elements. Display of the dropdown is tied to focusing the associated
input element. When the "focusout" event is observed, the dropdown is hidden.

However, since the "focusout" event is observed prior to the "click" event, the site
compares the "focusout" event's `currentTarget` and `relatedTarget`. If the
`relatedTarget` is the anchor element, the logic ends up suppressing hiding the
dropdown, ensuring the "click" is dispatched on the right element.

For `focusout` events, the `relatedTarget` should be the element that gains
focus. In WebKit, `relatedTarget` is null in this scenario, as anchor elements
are not mouse focusable, following Cocoa platform convention.

Fix by adding a quirk to make anchor elements mouse focusable.

* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isMouseFocusable const):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::needsAnchorElementsToBeMouseFocusable const):
* Source/WebCore/page/Quirks.h:

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




More information about the webkit-changes mailing list