Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Pressing shift+tab when focused in the middle of a contenteditable el…
…ement doesn't work https://bugs.webkit.org/show_bug.cgi?id=241902 Reviewed by Wenson Hsieh. The bug was caused by Document::focusNavigationStartingNode returning an element after the root editable element when m_focusNavigationStartingNode is set to a text node inside the focused element. When moving backwards starting at this node, we would find the root editable element as the previous focusable element and the focus never moves. Fixed the bug by detecting this case and returning the focused element as the starting node instead. * Source/WebCore/dom/Document.cpp: (WebCore::Document::focusNavigationStartingNode const): Return the focused element if the focused element is a root editable element and the focus navigation starting node is inside this editable element. * LayoutTests/fast/events/sequential-focus-navigation-after-clicking-editable-text-expected.txt: Added. * LayoutTests/fast/events/sequential-focus-navigation-after-clicking-editable-text.html: Added. * LayoutTests/platform/ios/TestExpectations: Canonical link: https://commits.webkit.org/252029@main
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
To test manually, click between two l's in hello below and press shift+tab. | ||
Focus should move to the text field. | ||
|
||
|
||
hello | ||
PASS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<script src="../../resources/ui-helper.js"></script> | ||
<p>To test manually, click between two l's in hello below and press shift+tab.<br> | ||
Focus should move to the text field.</p> | ||
<input id="textField"> | ||
<div contenteditable><span id="hello">hello</span></div> | ||
<div id="result"></div> | ||
<script> | ||
|
||
onload = runTest; | ||
didFocus = null; | ||
|
||
async function runTest() { | ||
if (!window.testRunner) | ||
return; | ||
|
||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
|
||
result.textContent = 'In progress'; | ||
|
||
await UIHelper.activateAt(hello.offsetLeft + hello.offsetWidth / 2, hello.offsetTop + 3); | ||
await UIHelper.keyDown('\t', ['shiftKey']); | ||
|
||
result.textContent = document.activeElement == textField ? 'PASS' : 'FAIL'; | ||
|
||
testRunner.notifyDone(); | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters