Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ee5f8073ed06b393060f99360182f15e51cfa79a
      
https://github.com/WebKit/WebKit/commit/ee5f8073ed06b393060f99360182f15e51cfa79a
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-04-25 (Sat, 25 Apr 2026)

  Changed paths:
    A LayoutTests/fast/events/tabindex-no-focusable-all-negative-expected.txt
    A LayoutTests/fast/events/tabindex-no-focusable-all-negative.html
    A LayoutTests/fast/events/tabindex-no-focusable-expected.txt
    A LayoutTests/fast/events/tabindex-no-focusable.html
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/page/FocusController.cpp

  Log Message:
  -----------
  Sequential focus navigation should not move focus between elements with 
negative tabindex
https://bugs.webkit.org/show_bug.cgi?id=248903
rdar://103370883

Reviewed by Ryosuke Niwa.

Merge: 
https://github.com/chromium/chromium/commit/957ae62f25a1b29a79ccfdfea5d3de654a882ffa

Per the spec [1], elements with a negative tabindex "should [be]
omit[ted] from any tabindex-ordered focus navigation scope." They are
focusable programmatically but pressing Tab or Shift+Tab should not
cycle through them. The sequential navigation search algorithm [2]
only considers "suitable sequentially focusable areas", which are
defined as focusable areas whose DOM anchor is sequentially focusable
— excluding negative tabindex elements.

Previously, when a negative tabindex element was focused,
nextFocusableElementOrScopeOwner and previousFocusableElementOrScopeOwner
would call findElementWithExactTabIndex with the negative tabindex value,
causing focus to advance to the next element with the same negative
tabindex. This patch moves those calls into an else branch so they only
run for non-negative tabindex values. Additionally,
previousFocusableElementOrScopeOwner now returns nullptr when the
starting tabindex is negative and no preceding non-negative element is
found, preventing previousElementWithLowerTabIndex from searching for
elements with even lower negative tabindex values.

[1] 
https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
[2] 
https://html.spec.whatwg.org/multipage/interaction.html#focus-processing-model

* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/page/FocusController.cpp:
(WebCore::FocusController::nextFocusableElementOrScopeOwner):
(WebCore::FocusController::previousFocusableElementOrScopeOwner):
* LayoutTests/fast/events/tabindex-no-focusable-all-negative-expected.txt: 
Added.
* LayoutTests/fast/events/tabindex-no-focusable-all-negative.html: Added.
* LayoutTests/fast/events/tabindex-no-focusable-expected.txt: Added.
* LayoutTests/fast/events/tabindex-no-focusable.html: Added.

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



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

Reply via email to