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

One-line text box widgets should select all text when receiving focus via keyboard #5992

Open
Enyium opened this issue Aug 29, 2024 · 4 comments
Labels
a:text Text rendering, fonts, Text input (mS,bF) bug Something isn't working

Comments

@Enyium
Copy link
Contributor

Enyium commented Aug 29, 2024

Widgets like LineEdit and SpinBox should select all of their text when they receive focus via keyboard. At least on Windows, this is common behavior.

In a shortcut (.lnk file) property dialog, e.g., you have multiple one-line text boxes. Initially, they are horizontally scrolled (no scrollbar, of course), so that the start of the text aligns with the left side of the text box. When you focus it, all text is selected, and (if it contains more text than can be displayed) the text box is horizontally scrolled, so that the end of the text aligns with the right side of the text box. When you then focus away from the text box, the horizontal scroll position stays the one that focusing established.

I wouldn't currently rule out that you could come up with a behavior regarding horizontal scrolling on focusing and unfocusing that'd be more desirable (probably taking into account, whether it was horizontally navigated between focusing and unfocusing). But the selection part helps with quick overwriting and is very useful in my opinion.

In the browser, I tested the text boxes on the following webpages as also implementing this behavior:

@slint-ui slint-ui deleted a comment Aug 29, 2024
@hunger hunger added the a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) label Aug 29, 2024
@ogoffart ogoffart added the need triaging Issue that the owner of the area still need to triage label Sep 6, 2024
@FloVanGH
Copy link
Member

Hi and thank you for your report.

@ogoffart this is more a a:text topic right?

@ogoffart ogoffart added a:text Text rendering, fonts, Text input (mS,bF) and removed a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) labels Sep 16, 2024
@tronical
Copy link
Member

Hmm, is it though? The functionality is there (it's possible to call select-all()), but whether this is to be done or not depends on the style?

@ogoffart
Copy link
Member

A Qt application on linux does it, as well as firefox.
Reporter says it is like that on Windows.
I think it still make sense to implement that in TextInput rather than on the style and having it gated it with #[cfg(not(target_vendor = "apple"))].

@tronical tronical added bug Something isn't working and removed need triaging Issue that the owner of the area still need to triage labels Sep 18, 2024
@tronical
Copy link
Member

You're right :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:text Text rendering, fonts, Text input (mS,bF) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants