primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.45k stars 4.6k forks source link

Dropdown: Tabbing away from dropdown sets selected item to first option #14307

Open erber014 opened 11 months ago

erber014 commented 11 months ago

Describe the bug

When tabbing to/from a dropdown in https://primeng.org/dropdown the first option is selected. This is surely not how its meant to work? Navigating through a page using tab should not set values in inputs in my opinion

Environment

https://primeng.org/dropdown latest version 17.0.0

Reproducer

No response

Angular version

Whatever the official site uses

PrimeNG version

latest version 17.0.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

Whatever the official site uses

Browser(s)

Firefox

Steps to reproduce the behavior

Go to https://primeng.org/dropdown, tab through page from dropdown to dropdown. Watch as all dropdowns have the first option set as selected item.

Expected behavior

Tabbing through dropdown component should not set selected item.

Orion151-C commented 11 months ago

I think it's a normal behavior. Just try to tab to the select field, move using your arrow keys, and then click tab again. Your 'pre-selected' option, which was navigated using the arrows, will be taken as the selected option when you tab again.

If you dont use arrows, by default it will take the first option.

Wykks commented 11 months ago

Normal behavior indeed : https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/#kbd_label

erber014 commented 11 months ago

I honestly dislike it, for an optional field that you don't want to fill in you would now need to manually clear the input every time you are navigating through the form. Maybe that's just me though... I also don't remember it working this way before, am I misremembering?

Wykks commented 11 months ago

Oh wait a sec, I assumed that you were talking about the behavior when the dropdown is open.

Actually, it looks like a bug to me too, that the first value is selected when tabbing out without opening the dropdown.

erber014 commented 11 months ago

No, I was talking about behavior when dropdown is never open and you are only tabbing through the form. Was starting to think either I was crazy or the world is crazy, thanks. :)

Da13Harris commented 9 months ago

They've been doing lots of work on fixing dropdown issues lately, and I think this one may have been fixed already. They've got quite the backlog of issues, so if this one is fixed I recommend closing it.