Skip to content

"autoselect" selects all text when browser gets focus back #8175

Open
@probert94

Description

@probert94

Description

I have a vaadin-text-field with autoselect.
When I select a part of the text and switch to another window and back to the browser, all text is selected again.
This is an issue if you are using for example Ditto clipboard tool as pasting focuses the Ditto window and before pasting, the browser is focused again.
The relevant code is in input-control-mixin.

Expected outcome

I would expect the text to only be selected if the field gets the focus in the webapp but not if the browser gets back the focus.
Another posibility would be to select all only if nothing is selected.

Minimal reproducible example

In this screen recording, the First name has autoselect=true, while the Last name has autoselect=false.
Not that when pasting into First name from Ditto, the whole text gets selected and overwritten, while it works as expected for Last name

Autoselect.mp4

Steps to reproduce

  1. Create a vaadin application with a field with "autoselect" set to true
  2. Focus part of the text
  3. Switch window and back to the browser
    All text is selected again

Environment

Vaadin version(s): Tested with 24.4.14

Browsers

Issue is not browser related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions