Skip to content

rc6 TagsTreeItem renaming will trigger onBlur event on second mouse click #388

Description

@PudiccaA

Describe the bug
I was going to rename one of my tags in the TagsTree, and I noticed that it is extremely hard to select or click the input text field after entering editing mode via double clicking. Additionally, even if I successfully move my pointer onto the text field, the editing will exit upon the second mouse click.

To Reproduce
Steps to reproduce the behavior:

  1. Go to TagsTree panel
  2. Double click on a tag
  3. When input field appears, click on the text field.
  4. If successful, click on the text field the second time.
  5. See the error described above.

Expected behavior
The renaming input text field should not close no matter how many times I click on it. The inputs should only be submitted if I click away from the input field, or use Esc/Enter keypresses.

Screenshots

I have logged out some debug infos. As shown in the video/gif, the handleSelect on the parent div was triggered whenever I clicked on the tag item, regardless of whether editing or not.
QQ截图20211205055551
handleSelect overriding child element click events is the cause of this bug. The second mouse click while editing the text field would trigger handleSelect and made onBlur believe that the input field lost focus, and thus triggered submit event, which in turn disabled editing.

I modified the line to onClick={isEditing ? handleSelectWhileEditing : handleSelect} so handleSelect is completely disabled if the current tag is being edited.

Here is the expected behavior after modification:

Allusion version

  • v1.0.0-rc6

Desktop OS

  • Windows 10

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions