-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Allow default input behavior for text selection on TagsInput and Combobox #1318
base: main
Are you sure you want to change the base?
Conversation
// allow text selection while maintaining `shift` key | ||
if(event.shiftKey) | ||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need it for Tags Input
. The current implementation works well, where we only focus on TagsInputItem
when we are not highlighting any text
Screen.Recording.2024-10-01.at.9.30.46.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you used arrows to select char one by one. This one enables text selection in its entirety or what's left of it with shift+home or shift+end. That is the expected behaviour when using a text input.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the following behavior ? I removed the tests I wrote because I think they're not great and couldn't figure it out.
Screencast.from.2024-10-02.21-52-00.webm
Screencast.from.2024-10-02.21-55-07.webm
input
tag using Shift + Home
or Shift + End
|
||
// prevent tag focus when there's something in the input | ||
// the user must clear the input if he needs to clear already added tags | ||
if (target.value.length > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the behavior we want. We want to allow user to focus on tags even when there's input value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that's the behavior you intended. However, it's hijacking the default behavior of a text input. Its purpose is to allow a user to enter a new value or perform a search, therefore it is reasonable to expect it to behave like a normal text input.
From a user's perspective, typing indicates the intention of adding or searching.
Therefore while he is typing, he should be able to select it as he normally would. That intention should be prioritized over the intention of focusing tags that were already added.
I believe you should reconsider this behavior. Otherwise feel free to close the PR.
Many thanks
When typing inside the input of a
combobox
ortagsinput
it should be allowed to select that text withshift
+ eitherleft
,right
,home
orend
.The current behavior is preventing the combination of
shift+end
andshift+home
.