Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4e2ff065567a0291ed0c7af24052a56e8c54a2a2
      
https://github.com/WebKit/WebKit/commit/4e2ff065567a0291ed0c7af24052a56e8c54a2a2
  Author: Brent Fulgham <[email protected]>
  Date:   2026-08-18 (Tue, 18 Aug 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/html/dialog-focus-after-modal-close-expected.txt
    A LayoutTests/fast/html/dialog-focus-after-modal-close.html
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-previous-outside-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-top-layer-nesting-hints-expected.txt
    M Source/WebCore/html/HTMLDialogElement.cpp

  Log Message:
  -----------
  [dialog] show() should invalidate style so the focusing steps see the dialog 
as rendered
https://bugs.webkit.org/show_bug.cgi?id=321980
rdar://185156091

Reviewed by Tim Nguyen.

After a modal dialog is closed its cached computed style says display:none. 
show() set the
open attribute but did not mark that style invalid, and
Element::resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly) treats a 
cached
display:none ancestor as an unrendered subtree unless the ancestor is flagged 
as having an
invalid computed style. Every focus candidate inside the dialog therefore looked
unfocusable, so the dialog focusing steps had nothing to focus and focus did 
not move. An
explicit focus() on the dialog's contents failed at the same point.

showModal() was unaffected only because addToTopLayer() ends with an explicit
invalidateStyle(). Invalidating style here rather than updating it means 
nothing is
computed at call time, so this does not determine content-visibility proximity 
early the
way a forced style update would.

The underlying resolveComputedStyle() behavior is tracked separately by 
rdar://185153996;
addToTopLayer() and show() are now both compensating for it at their call sites.

This also folds in unrelated popover gardening. 
popover-top-layer-nesting-hints.html has
been passing all 20 subtests, but its baseline recorded four failures and a
[ Pass Failure ] expectation accepted either outcome, so the test provided no 
signal.
Verified over 50 iterations with num_flaky 0.

* Source/WebCore/html/HTMLDialogElement.cpp:
(WebCore::HTMLDialogElement::show):
* LayoutTests/fast/html/dialog-focus-after-modal-close.html: Added.
* LayoutTests/fast/html/dialog-focus-after-modal-close-expected.txt: Added.
* LayoutTests/TestExpectations: Remove the obsolete [ Pass Failure ] 
expectation.
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-previous-outside-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-top-layer-nesting-hints-expected.txt:

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



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

Reply via email to