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

Ignore selection range update when the element is not focused #544

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

ShawnCZek
Copy link
Contributor

As hinted in #542 (comment), SetSelectionRange() should be closer to what browsers do; ignore such API calls when the input element is not focused. There is no reason for doing so.

Chromium nowadays queues such events for a short period of time, perhaps to make the API call order less strict (i.e., you focus the element after setting the selection range). The exact reason is unknown to me.

Copy link
Owner

@mikke89 mikke89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Yeah, this change makes sense to me. I only have a small comment on the implementation here.

Source/Core/Elements/WidgetTextInput.cpp Outdated Show resolved Hide resolved
@mikke89 mikke89 added the enhancement New feature or request label Nov 26, 2023
@mikke89 mikke89 merged commit 61d1a4b into mikke89:master Nov 27, 2023
14 checks passed
@mikke89
Copy link
Owner

mikke89 commented Nov 27, 2023

Perfect, thank you!

@ShawnCZek ShawnCZek deleted the set_selection_range_focused_element branch November 27, 2023 21:09
alml pushed a commit to alml/RmlUi that referenced this pull request Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants