vaadin / flow-components

Java counterpart of Vaadin Web Components
101 stars 66 forks source link

DatePicker and Combobox ignore key modifiers #6765

Open guttormvik2 opened 2 weeks ago

guttormvik2 commented 2 weeks ago

Describe the bug

DatePicker and Combobox fields open their panel on ArrowUp/ArrowDown, but they ignore the modifiers, so that ctrl-ArrowUp, shift-ArrowUp etc does the same.

This again means it is not possible to add my own Alt-ArrowUp/Down listener (which I want to do to move editor row up/down in Grid)

I see the same behavior in KeyNotifier.addKeyDownListener. I assume most users are not aware that any modifier they don't specify is ignored, and they have to test event.modifiers themselves. Strangely enough, it looks like Shortcuts.addShortcutListener does it the right way.

Expected-behavior

DatePicker and Combobox fields should do nothing on [any modifier given]-ArrowUp/ArrowDown

Reproduction

In https://vaadin.com/docs/latest/components/combo-box#auto-open click in field and press ctrl-shift-Alt-ArrowDown

System Info

Windows 10, Vaadin 24.5.1, Firefox 131.0.3

TatuLund commented 2 weeks ago

To fix e.g. DatePicker this one need to add condition here

https://github.com/vaadin/web-components/blob/main/packages/date-picker/src/vaadin-date-picker-mixin.js#L1122

Similar to this: https://github.com/vaadin/web-components/pull/6404/files