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

Tab rename fix — double click to enter rename mode #28

Merged
merged 8 commits into from
Jan 8, 2023

Conversation

chaosarium
Copy link
Collaborator

@chaosarium chaosarium commented Dec 31, 2022

Fixes #16

Capture d’écran 2022-12-31 at 18 54 12

New issues:

  • Dragging tab in edit mode causes weird behaviours
  • Using mouse click to move input cursor doesn't work on Firefox (arrow keys still work), but works on Chrome
  • File extension can be changed despite popup warning
  • Pressing enter in edit mode doesn't complete the edit

Potential fixes

  • Set draggable = "true" to draggable = "false" on div.ant-tabs-nav-list > div temporarily while editing tab name
  • Either:
    • show the .c0 extension in a separate tag wile editing
    • update current tab name extension enforcement
    • Allow any extension but only run c0 code (probably the way to go since we're now allowing c1 and o0.
  • Somehow listen to the enter key in edit mode


onChange(e: React.ChangeEvent<HTMLInputElement>) {
e.preventDefault();
this.setState({title: e.target.value});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that we only setState when the user has finished editing (a.k.a. stopEditing is triggered)?

In that case, we will be able to enforce the file extension check (if not ending in .c0, .c1, we reject the rename).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, just curious, what is the "wired behavior" of draggable tab when editing file names?

@chaosarium
Copy link
Collaborator Author

chaosarium commented Jan 7, 2023

Update:

  • A rename will be rejected if it doesn't end in .c0 or .c1
  • Name check only happens after rename input looses focus
  • Pressing enter key ends rename

Capture d’écran 2023-01-07 at 00 42 17

Dragging tab issue is Firefox specific and should probably go into another issue if critical.

@chaosarium chaosarium marked this pull request as ready for review January 7, 2023 05:40
@MarkChenYutian MarkChenYutian merged commit 6af5cf9 into main Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename tab not intuitive (UI improvement)
2 participants