gecko-dev/layout/base/tests/bug1524266-1.html
Emilio Cobos Álvarez 073adf9499 Bug 1524266 - Should be able to delete non-selectable and non-editable content in a contenteditable subtree. r=mats
This makes our behavior a bit closer to Blink / WebKit.

This patch fixes multiple issues:

First, fixes the caret movement getting stuck on a <select> element inside an
editor. This is because of the IsRootOfAnonymousSubtree() check that I'm
removing. Instead of that, consider NAC unselectable in UsedUserSelect, just
like generated content. This makes us jump across it correctly, and doesn't
regress the test-case that was added in bug 989012.

Second, it allows to select nodes with user-select: none as long as you're on an
editor. This matches WebKit and Blink. It's something you could do earlier
regardless with user-select: all on the parent, which is why the reporter's
test-case worked before my patch. I think being able to jump across these and
delete them on an editor is the right thing to do.

It adds tests for all this plus the same thing working for non-editable contents
(there was no pre-existing test for that).

Differential Revision: https://phabricator.services.mozilla.com/D18494
2019-02-04 12:03:32 +01:00

28 lines
718 B
HTML

<!doctype html>
<html class="reftest-wait">
<title>Caret doesn't get stuck in a select element inside an editor</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<style>
div:focus {
outline: 3px solid blue;
}
</style>
<div contenteditable="true" spellcheck="false">
xx
<select>
<option value="">Placeholder</option>
</select>
xxx
</div>
<script>
SimpleTest.waitForFocus(function() {
document.querySelector('[contenteditable="true"]').focus();
requestAnimationFrame(function() {
for (let i = 0; i < 7; ++i)
synthesizeKey("KEY_ArrowRight");
document.documentElement.removeAttribute("class");
});
});
</script>