Closed Bug 1820788 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 38850 - Use AdjustedFocusedElement when clearing focus from children

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Depends on 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 38850 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/38850
Details from upstream follow.

Mason Freed <masonf@chromium.org> wrote:

Use AdjustedFocusedElement when clearing focus from children

In this case:

\<my-button>
\<template shadowrootmode=open>
\<button>\<slot>\</slot>\</button>
\</template>
Button contents
\</my-button>

when the shadow root button is focused, calling
myButton.textContent='' clears the focus. This is due to a change made
for performance reasons in [1], but I think it's not the right behavior.
The focus should not be cleared in this case, since the adjusted focused
element is still the \<my-button> element.

This CL goes back to using AdjustedFocusedElement. This might have
a negative perf impact, but I think it's important to not clear
focus for custom elements in this case.

[1] https://chromium.googlesource.com/chromium/src/+/9aab5fab831e4ce17a65d436c214deb650520355

Fixed: 1300584
Change-Id: I3c79dd41c92da9bd35d715bab56e2b8fdef50008
Reviewed-on: https://chromium-review.googlesource.com/4305572
WPT-Export-Revision: 693498772e477075cca4a6c97d4387922dadc5fb

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Test result changes from PR not available.
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1b4cbe54b8db [wpt PR 38850] - Use AdjustedFocusedElement when clearing focus from children, a=testonly
Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.