<script>
document.addEventListener("selectionchange", function() {
const selection = getSelection();
console.log("Selection changed!");
});
</script>
<input autofocus>
<button>
Steps:
1. out/Debug/content_shell -u http://logikbyran.se/editing/1.html
2. Hit Tab-key on your keyboard (focus moves to <button>).
Actual: selectionchange event(s) and selection is cleared.
Expected: no selectionchange event(s) and selection looks cleared (not painted).
<script>
document.addEventListener("selectionchange", function() {
const selection = getSelection();
console.log("Selection changed!");
});
</script>
<input autofocus>
<button>
Steps:
1. out/Debug/content_shell -u http://logikbyran.se/editing/1.html
2. Hit Tab-key on your keyboard (focus moves to <button>).
Actual: 1 selectionchange event (selection is cleared).
Expected: 0 selectionchange events and selection looks cleared (not painted).
Note on web compatibility:
A conflicting behavior is found in Firefox 52.0 (beta). Difference is, Firefox sends 2 (identical?) selectionchange events that say the selection (here the invisible cursor) moved to the button. So to align with Firefox, we could also image:
Expected*: 1 selectionchange event (selection follows Tab-key's focus move to the <button>).
Comment 1 by hu...@opera.com
, Mar 7 2017