Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Clear selection? #1020

@jisaacks

Description

@jisaacks

When you have a selection of text, then click away blurring the component, then click back focusing the component again, the same selection remains. A second click must then be performed to clear the selection and place the cursor under the mouse.

This is bazaar and not the way textareas normally behave.

Normally when you blur a textarea, the selection is lost, and when you focus a textarea, the cursor is placed at the point in which you clicked.

I am trying recreate the normal textarea behavior and nothing I try seems to do the trick.

Since this only happens if there is a current selection. And it behaves correctly if there is no selection. My thought is to clear the selection on blur.

I have tried various combinations of using moveSelectionToEnd, and forceSelection and acceptSelection with SelectionState.createEmpty but nothing I try actually clears the selection. The previous selection is always there when I focus the component.

What is the appropriate way to clear the selection on blur and place the cursor at the correct spot on focus, the way a generic textarea behaves?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions