Skip to content
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/HTML: incorrect behavior on select() #1446

Open
mobounya opened this issue Sep 19, 2024 · 2 comments · May be fixed by #1458
Open

LibWeb/HTML: incorrect behavior on select() #1446

mobounya opened this issue Sep 19, 2024 · 2 comments · May be fixed by #1458
Labels
bug Something isn't working has repro We have a way to reproduce this bug.

Comments

@mobounya
Copy link
Contributor

mobounya commented Sep 19, 2024

when calling select() on an input element it only works for the first time, clicking somewhere else and calling select() again does not work unless you change the text on the element.

incorrect behavior on Ladybird Ubuntu:
ladybird

correct behavior on google chrome:
chrome

HTML code:

<script>
    let mySelect = () => {
        let foo = document.getElementById("foo");
        foo.select();
    }
</script>

<input type="text" id="foo"/>
<button style="padding: 15px" id="button" onclick="mySelect()">Select</button>
@ronak69
Copy link
Contributor

ronak69 commented Sep 19, 2024

Notice how prior to typing, the box is not vertically centerd with respect to the button box.

Also, tabbing more than two times (focus going past the button) freezes the app?

@mobounya
Copy link
Contributor Author

yes both points are true, I guess they should be two more separate issues ?

An-n-ya added a commit to An-n-ya/ladybird that referenced this issue Sep 20, 2024
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.
@An-n-ya An-n-ya linked a pull request Sep 20, 2024 that will close this issue
An-n-ya added a commit to An-n-ya/ladybird that referenced this issue Sep 20, 2024
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.
An-n-ya added a commit to An-n-ya/ladybird that referenced this issue Sep 20, 2024
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.
An-n-ya added a commit to An-n-ya/ladybird that referenced this issue Sep 20, 2024
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.

Closes LadybirdBrowser#1446
An-n-ya added a commit to An-n-ya/ladybird that referenced this issue Sep 20, 2024
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.

Closes LadybirdBrowser#1446
An-n-ya added a commit to An-n-ya/ladybird that referenced this issue Sep 20, 2024
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
@AtkinsSJ AtkinsSJ added bug Something isn't working has repro We have a way to reproduce this bug. labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has repro We have a way to reproduce this bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants