-
Notifications
You must be signed in to change notification settings - Fork 436
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
Tabulation in dropdown makes tagify fail #1397
Comments
PS. Updated the URL cause I used the wrong one |
And that's an updated JSBin with the proposed solution https://jsbin.com/veyiqezobo/edit?html,js,console,output |
Thank you for the detailed analysis! The fix should be done in Tagify's source code though. I will work on it. |
Thank you! I found that this also happens in some other situations:
I think the relevant code is here events.js#L502 And as a bonus 😂 I can see that the blur is somehow not executed (the border is still blue after leaving the input). |
BTW, this is the correct way to use Tagify with objects in the var tagify = new Tagify(input,
{
tagTextProp: "name",
dropdown: {
enabled: 0,
includeSelectedTags: true,
mapValueTo: "name"
},
whitelist: [
{
"value": "1",
"name": "One",
"title": "One",
},
{
"value": "2",
"name": "Two",
"title": "Two",
},
{
"value": "3",
"name": "Three"
"title": "Three",
}
],
}) you should define the also added |
Yeah this was a stripped down version of the project and in production I'm using it as you suggested (in scripts.js) |
Mmmmh this sounds incredibly similar to #1279 (and the very latest post suggestion works). I kepp my point though, Tab should not select things, but escape from dropdown. Also, the value inserted is wrong anyway and this should not be the case. Thank you anyway, no need to rush for this |
Prerequisites
💥 Demo Page
https://jsbin.com/kedanixiso/edit?html,js,console,outputhttps://jsbin.com/noxuzusave/1/edit?html,js,console,output
Explanation
Go on the demo page and tab on the tagify input so that the dropdown opens. Continue tabbing, the first value is inserted. This should not happen because the first value ("1") is already present in the input. This happens because when tabbing (and only when tabbing, this does not happen when using the mouse to select) the name is passed as value instead of the real value in
transformTag
. This also has the side effect or creating a corrupted output list.I suggest not to fix this, but simply to disable select with the tab key cause this is an issue for impaired users (how are they supposed to escape the dropdown after it opened?) I know they can use the
esc
key it but it is not really intuitive, it would be better to close the dropdown with another tab click, and if the user really wants to select something, he obviously will do with arrows/enter keys.What is the expected behavior?
Inserting a value with tab key should work normally
What is happening instead?
The name is passed instead of the value in
transformTag
The text was updated successfully, but these errors were encountered: