Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 71b1107b4656f116936a278cb4948cc2db56998c
https://github.com/WebKit/WebKit/commit/71b1107b4656f116936a278cb4948cc2db56998c
Author: Tyler Wilcock <[email protected]>
Date: 2025-01-09 (Thu, 09 Jan 2025)
Changed paths:
M LayoutTests/accessibility/aria-modal-in-aria-hidden.html
M LayoutTests/accessibility/aria-modal-multiple-dialogs.html
M LayoutTests/accessibility/aria-modal-text-descendants.html
M LayoutTests/accessibility/aria-modal.html
M LayoutTests/accessibility/custom-elements/modal.html
M LayoutTests/accessibility/gtk/aria-modal-state-exposed.html
M LayoutTests/accessibility/ignore-modals-without-any-content-expected.txt
M LayoutTests/accessibility/ignore-modals-without-any-content.html
R LayoutTests/accessibility/mac/aria-modal-auto-focus-expected.txt
R LayoutTests/accessibility/mac/aria-modal-auto-focus.html
M
LayoutTests/accessibility/recompute-current-modal-after-aria-modal-element-appears.html
M
LayoutTests/platform/ios/accessibility/ignore-modals-without-any-content-expected.txt
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
Log Message:
-----------
Safari moves focus to first focusable element inside an element with
role="dialog" and aria-modal="true" when added to the DOM
https://bugs.webkit.org/show_bug.cgi?id=236585
rdar://88897436
Reviewed by Chris Fleizach.
We behaved this way because https://w3c.github.io/aria/#aria-modal says:
> When a modal element is displayed, assistive technologies SHOULD navigate to
> the element unless focus has explicitly been set elsewhere.
Note that it says "assistive technologies", which likely moreso referred to
VoiceOver and others.
Regardless of who is doing the focusing, this behavior has proven problematic
in several ways:
1. We are the only browser who does this, causing difficulty for web
developers.
2. This behavior is kind of contrary to developer documentation, e.g. MDN,
which states that users of aria-modal
must manage focus themselves.
3. Most importantly, this behavior means we autofocus into any aria-modal,
including ones that are poorly authored
(e.g. have no close button). This has caused lots of user pain that greatly
overshadows the user benefit for
valid users of aria-modal (who should be managing focus themselves anyways).
With this commit, we remove WebKit's autofocus-into-aria-modal behavior. Dialog
elements will continue autofocus.
This commit also fixes a bug where a modal would be invalidated if focus was on
the aria-modal element and not a descendant.
* LayoutTests/accessibility/aria-modal-in-aria-hidden.html:
* LayoutTests/accessibility/aria-modal-multiple-dialogs.html:
* LayoutTests/accessibility/aria-modal-text-descendants.html:
* LayoutTests/accessibility/aria-modal.html:
* LayoutTests/accessibility/custom-elements/modal.html:
* LayoutTests/accessibility/ignore-modals-without-any-content-expected.txt:
* LayoutTests/accessibility/ignore-modals-without-any-content.html:
* LayoutTests/accessibility/mac/aria-modal-auto-focus-expected.txt: Removed.
* LayoutTests/accessibility/mac/aria-modal-auto-focus.html: Removed.
*
LayoutTests/accessibility/recompute-current-modal-after-aria-modal-element-appears.html:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::updateCurrentModalNode):
(WebCore::AXObjectCache::handleAttributeChange):
(WebCore::AXObjectCache::performDeferredCacheUpdate):
(WebCore::firstFocusableChild): Deleted.
(WebCore::AXObjectCache::focusCurrentModal): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:
Canonical link: https://commits.webkit.org/288641@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes