-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Removing a focused element from the tree doesn't reset focus #26900
Copy link
Copy link
Closed
Labels
A-content/domInteracting with the DOM from web contentInteracting with the DOM from web contentC-has-manual-testcase
Description
<body>
<style>div:focus { color: red; }</style>
<div tabindex=0 id="a" style="background-color: green; width: 100px; height: 100px;"><button onclick="this.parentNode.remove()">remove</button><p>hello</p></div>
<script>
let div = document.querySelector('#a');
div.focus();
div.onkeydown = (e) => { console.log('div down ' + e.key); };
div.onkeyup = (e) => { console.log('div up ' + e.key); };
document.body.onkeydown = function(e) {
console.log("body down " + e.key);
};
document.body.onkeyup = function(e) {
console.log("body up " + e.key);
};
</script>
In Firefox, when I press a, then click the remove button and press a again, I see:
div down a
body down a
div up a
body up a
body down a
body up a
Which indicates that the focus was reset such that the div that was removed from the tree is no longer focused.
In Servo, doing the same gives me:
div down a
body down a
div up a
body up a
div down a
div up a
Which indicates that we don't reset the focus when the div is removed from the tree.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-content/domInteracting with the DOM from web contentInteracting with the DOM from web contentC-has-manual-testcase