Bug 1820788 [wpt PR 38850] - Use AdjustedFocusedElement when clearing focus from...
commit36da87375784435e3c198206b9210c743ec49a0f
authorMason Freed <masonf@chromium.org>
Mon, 20 Mar 2023 18:07:44 +0000 (20 18:07 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Wed, 29 Mar 2023 12:50:18 +0000 (29 12:50 +0000)
tree26c3e25622e3d6e2b0244c72f8c2052a5b208592
parent2301aa1bfe86dd27ab47504d0cca2fd6f9e84055
Bug 1820788 [wpt PR 38850] - Use AdjustedFocusedElement when clearing focus from children, a=testonly

Automatic update from web-platform-tests
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/c/chromium/src/+/4305572
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Mason Freed <masonf@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1114311}

--

wpt-commits: 14684f837eba364df3de2b6683d4eb5385333158
wpt-pr: 38850
testing/web-platform/tests/shadow-dom/focus-within-shadow.html [new file with mode: 0644]