I'm submitting a ... (check one with "x")
[? ] bug report
[x ] feature request
Current behavior
The (onChange) behaviour is called when using the dropdown with the keyboard up/down arrows
Expected behavior
Most dropdowns do not do this by default, instead the actual value is only changed when pressing enter with the value you want to have focused.
What is the motivation / use case for changing the behavior?
I am working on accessibility, and some of our dropdowns open panels/alerts when clicked. There is no way to browse the options in a dropdown with the keyboard without triggering these events (and hence loosing focus on the dropdown). I want to be able to browse the dropdown with the up/down keys and then press enter to choose the value i want
The workaround I currently see for this is to capture the original event and prevent the default onChange() behaviour, (maybe store current value somewhere) and then call it seperately on keydown.enter
OR
have the onChange() event not trigger the sidepanel/alert function, only change the value. In addition have a button adjacent to the dropdown to call the corresponding function on press. But this ruins the experience for users as there are more clicks
Angular version: 2.0.X
Angular 5.1.3
PrimeNG version: 2.0.X
Prime 5.2.9
+100
As the value is changed, we must call onChange since model is updated. The behavior depends on browsers for native select and p-dropdown picks an opinion.
The problem is that value should only be changed on SELECTING a value, not while NAVIGATING with up/down arrow keys?
Hey @arsunda - were you able to find out any workaround for this issue? The original event is undefined sometimes! Thanks.
@tibinvpaul I don't remember getting any undefined events, but one of the workarounds we used was to have a "Save" button that would take the model changes and use it. You might also want to try listening to something like a focusout event to use the model changes when the user closes the dropdown
this is a design flaw... dropdowns don't work this way. The user is free to "browse" the list before making a selection. A selection is made only by actively clicking on an item or pressing ENTER with the item highlighted.
The current implementation is very strange and non-intuitive.
Most helpful comment
The problem is that value should only be changed on SELECTING a value, not while NAVIGATING with up/down arrow keys?