-
-
Notifications
You must be signed in to change notification settings - Fork 980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LibWeb: Fix "incorrect behavior on select()" #1458
Conversation
Hello! One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the |
e52f7c3
to
e25160f
Compare
The Issue number is not needed in the commit name, instead you can put |
Paging @Gingeh ! |
This patch resolves the problem outlined in issue LadybirdBrowser#1446, where the cursor_position node could be substituted with any other existing node by the mousedown event. Previously, if this new node was not equal to m_text_node, the function would return prematurely without updating the selection. With this fix, we ensure that the selection is properly updated in such cases, rather than simply exiting the function. Also, in order to address the issue in LadybirdBrowser#1339, the logic of document().set_cursor_position has been put behind to the logic of Selection. Closes LadybirdBrowser#1446
Very good! |
Normally, we can use <input type="text" id="input" value="foo" />
<input type="text" id="boo"/>
<script src="../include.js"></script>
<script>
test(() => {
// simulate issue #1446
let input = document.getElementById("input");
let boo = document.getElementById("input");
input.select();
boo.select();
input.select();
let sel = document.getSelection();
if (sel.anchorNode) {
println("PASS");
}
});
</script> which doesn't correspond to issue in #1446 precisely, so I think it would be better to complete this test case once we have a more robust interface (e.g., document.activeElement). |
The test case in Issue-1446 works fine now but I also checked with |
In light of recent changes, is this still relevant? If so, @An-n-ya, could you please rebase and resolve the conflicts? |
The function |
This patch resolves the problem outlined in issue #1446. The problem is the cursor_position node could be substituted with any other existing node by the
mousedown
event. Previously, if this new node was not equal to m_text_node, the function would return prematurely without updating the selection.With this fix, we ensure that the selection is properly updated in such cases, rather than simply exiting the function.
Also, in order to address the issue in #1339, the logic of
document().set_cursor_position
has been put behind to the logic of Selection.Closes #1446