yairEO / tagify

🔖 lightweight, efficient Tags input component in Vanilla JS / React / Angular / Vue
https://yaireo.github.io/tagify/
Other
3.48k stars 429 forks source link

default highlighting of selected value in single-select mode in the dropdown #1350

Closed dirslashls closed 2 months ago

dirslashls commented 3 months ago

The html select component by default shows the currently selected value highlighted when the dropdown is invoked. However, tagify just shows the first value in the dropdown as highlighted. See attached screenshot taken from the demo page (second option is currently selected while the highlight by default is on the first option).

select-default-highlight
yairEO commented 2 months ago

Some months ago I've changed the setting dropdown.highlightFirst to be true by default: https://github.com/yairEO/tagify/blob/master/src/parts/defaults.js#L86

I thought it would be easier for users to add tags while typing a value and seeing the suggestions list filtered so they could just press the ENTER key after they are finished and it would select the first item in the suggestions list because that would be the most probable match.

I can change the default back to false if you believe this to be a bad change of my part

dirslashls commented 2 months ago

Thanks @yairEO for the response. Default of dropdown.highlightFirst to true is fine as I can set it to false in my app. However, when I just tried false it doesn't highlight the currently selected item which is the behavior of HTML select. Is it possible to get this behavior when the dropdown.highlightFirst is false?

yairEO commented 2 months ago

I can change the code to auto-highlight the already-selected tag (if the highlightFirst setting it set to false), but I don't see what benefits this provides to users

dirslashls commented 2 months ago

I agree the default highlighting is not that useful because the dropdown doesn't show up like the html select (spanning both the top and bottom of the select control). However, would it be possible to visually indicate the currently selected item? See attached video for the HTML select.

https://github.com/yairEO/tagify/assets/2200491/9e8d2c1a-bd93-471e-b1a0-fc804c790b22

yairEO commented 2 months ago

Done, check it out:

https://github.com/yairEO/tagify/releases/tag/v4.27.0

See it live: https://yaireo.github.io/tagify/#section-mode-select