shentao / vue-multiselect

Universal select/multiselect/tagging component for Vue.js
https://vue-multiselect.js.org/
MIT License
6.69k stars 988 forks source link

Focus on multiselect should not open the dropdown #740

Closed chinchang closed 6 years ago

chinchang commented 6 years ago

Current behaviour:

When multiselect receives focus, the dropdown shows.

Issue:

For people who use keyboard for navigation, they need to keep hitting Tab key to cycle through element. While cycling through the elements, if a multiselect receives focus, it immediately shows the dropdown - but the user isn't there to use it, just a transient focus.

Proposal:

The dropdown should open only on user action after focus, just like the native <select> element in browser. At least have a prop to do so.

wisamx commented 6 years ago

another thing, which I think is done wrong, is that when using the multiselect as tagsinput, it opens when it receives focus (it shouldn't). It should open when the user types in the input.

plweil commented 6 years ago

I agree that focus, or focus alone, should not activate the dropdown for the reasons given by @chinchang

My suggestion for 3.0: The default activate trigger should probably be typing the search string (with number of characters required to activate as an option).

I would also favor offering an option to activate the dropdown on a click event in the text input, which would simulate a "normal" dropdown. But this is not a "normal" dropdown menu; it's more of a search filter. That's why I would make this an option rather than the default behavior.

I know that figuring out all of the keyboard and click events for the input can get tricky, but I think this is a good place to start.

shentao commented 6 years ago

Thanks, I think that’s a valid suggestion. Will probably do it this way in 3.0.

andreasvirkus commented 6 years ago

I can't reproduce what @chinchang says is the issue. Once an element receives focus and a dropdown opens - pressing the tab key again will just transfer focus to the next element and doesn't start cycling through the options.

I'd say that opening the dropdown is fine and almost necessary for single select, since how else would you know to distinguish it from other fields (I'd argue that the chevron alone might not be enough).

I feel that typing is an enhancement (at least for single select type fields) and a user should be able to simply click/tab into focus and select an option.

plweil commented 6 years ago

@chinchang's point is that the dropdown should not open on what is intended to be a transient focus. On your second point/question, I think the answer is good labeling (and not just a placeholder), perhaps along with another element with more detailed instructions that is linked to the input via aria-describedby. Screenreader users won't know about the chevron, so an informative label element (and possibly more) is a must -- that goes for any form field.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kimvargas commented 5 years ago

@shentao I know this issue is closed and labeled won't fix, but you mentioned adding this functionality (prevent dropdown opening on focus/only open on user input) to version 3.0. Is this still the plan? Where can I find the eta on 3.0? Thanks!

shentao commented 5 years ago

It's already implemented in v3. You can try it out on the v3 branch if you’d like. Hopefully, I will be able to finish the next version in early March. Got to figure out how to handle grouping.

pedroAlba commented 4 years ago

Any news on this?

shentao commented 4 years ago

Will need to work on accessibility improvements for v3 and then it will hopefully be ready for realease...

DBCOOPER90 commented 4 years ago

any news for release 3.0 ? I desperately need this to be wcag compliant or at least accessible when tabbing with a reader. Nornal Tabbing works, but as soon as you use a reader like NVDA, you tab the dropdown and if you try to go up and down with your arrows in the selected list, it reads the options but doesn't allow you to "select" them by pressing enter or space. If you put it to searchable, it reads all "blanks". I'm using a mutli select dropdown, no tags and 2 groupings.

shentao commented 4 years ago

Hey @DBCOOPER90! If you can help out with making the v3 branch WCAG compliant, I will release the new version. Otherwise, the soonest I could work on this is likely mid-April... :(

plweil commented 4 years ago

@shentao - I'd be willing to take a look at it, but which branch is v3? I can't tell.

shentao commented 4 years ago

It’s this branch: https://github.com/shentao/vue-multiselect/tree/v3 There were some small issues with group-select (groups support) that still need to be solved as well as a11y. After that, I think we will be able to release it as beta. I would have done that already but sadly I couldn’t find noone that would help me validate all the ideas in version 3. And so the rewrite ended up in a limbo.

plweil commented 4 years ago

@shentao Thanks. Do you have a fiddle or something running v3 that I could look at first? That would enable me to do some quicker basic/preliminary analysis of a11y issues before I take the time to plug it it into an app, populate data, etc. Thanks. I've done a lot of work on a custom autocomplete component ) initially based on others' code, and I can say that some of the accessibility stuff can be quite challenging.

shentao commented 4 years ago

The v3 branch has vuepress docs that use the local version of vue-multiselect and can be used to testdrive it in several configurations. To start it, you got to run yarn docs:dev

Also agree on a11y being quite complicated in that kind of components. That’s also one of the reasons why I haven’t worked on it. The amount of edge cases is pretty overwhelming sadly and requires a lot of expertise.

plweil commented 4 years ago

Great, thanks! I think edge cases can be set aside initially; it's more important to first get the basic stuff as good as you can reasonably make it. Will you be in Austin?

shentao commented 4 years ago

Agree! Yes I will be there. I assume so will you, so let’s meet in person there!

plweil commented 4 years ago

Sent an email to your address @dulisz.com

On Feb 25, 2020, at 1:27 AM, Damian Dulisz notifications@github.com wrote:

Agree! Yes I will be there. I assume so will you, so let’s meet in person there!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.