Avalonia: Select all text in TextBox on tabulation

Created on 25 Aug 2016  路  10Comments  路  Source: AvaloniaUI/Avalonia

If I press Tab key and focus jumps to TextBox contol the text in this TextBox not selected but it should.

bug

Most helpful comment

Sounds reasonable. I've been wanting to get involved in this project, this looks like a good place to start. I'll take a look.

All 10 comments

WPF and Avalonia have the same behavior. Some other applications (like Chrome) do auto-highlight textboxes. But if the goal is to emulate what WPF does, there is no bug here. Tested on commit 7b4c10a7f8b.

WPF
wpf_tab_into_textbox

Avalonia
avalonia_tab_into_textbox

Yeah, to be honest I think WPF's behavior is wrong: I'd expect auto-selection of text personally.

@grokys is right, auto-selection is more intuitive. It's convenient when you fill fields without mouse by just text typing without old text removing.

Maybe add "SelectAllOnTab" option with default parameter of "true" for TextBox controls?

Sounds reasonable. I've been wanting to get involved in this project, this looks like a good place to start. I'll take a look.

To be honest, i'd just make it select all text by default for the moment. I don't know if a property is necessary.

I can imagine the following case: Text editor with big multiline text field and another small singleline fields. If tabulation works and we go into this big filed, entire text should not be selected.

Hmm, true. What does e.g. Chrome do? Does it allow you to turn the feature on/off? Does it disable it based on whether the input is multi-line? We should try to follow the example of others here.

I just tried tabulation in Chrome.
Indeed: it selects all text in singleline text boxes and not change selection in multiline ones. See video. Sorry for the bad quality, but concept is clear.

That sounds like a good behavior to me. I'd rather not introduce options if we don't have to.

PR #745 fixes this issue. If the textbox is single line, select all text. If it has no text or it is a multiline textbox (acceptsreturn is true), then show the caret like before.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SeleDreams picture SeleDreams  路  4Comments

danwalmsley picture danwalmsley  路  4Comments

CreateLab picture CreateLab  路  3Comments

Suriman picture Suriman  路  3Comments

GitHubington picture GitHubington  路  3Comments