p-calendar: Pressing Enter key on prev or next month arrows calls onPrevButtonClick or onNextButtonClick twice respectively #9521
Labels
LTS-FIXED-10.0.6
Fixed in PrimeNG LTS 10.0.6
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
Current behavior
When the enter key is used to navigate between months, it skips a month. For example, if the current month is July and I press the enter key when previous month arrow is focused, the calendar displays May.
Expected behavior
I would expect the calendar to go -1 or +1 month. For example, if the current month is July and I press the enter key when previous month arrow is focused, the calendar should display June. (I think it is worth mentioning that when pressing the space bar key, it functions as expected - it navigates 1 month at a time.)
Minimal reproduction of the problem with instructions
STEPS TO REPRODUCE
p-calendar
element to an angular html fileinline
attribute totrue
MINIMAL DEMO
https://stackblitz.com/edit/github-primeng-calendar?file=src/app/app.component.html
What is the motivation / use case for changing the behavior?
A user cannot use the Enter key to effectively navigate between months because it skips a month when Enter is used.
I think this behavior is caused by the two event listeners on the previous and next buttons -
(click)
and(keydown.enter)
. Buttons by default triggerclick
events when Enter or Space bar are pressed. I am probably missing something and would appreciate any info, but I am not sure what the reason for having an additional listener for Enter key here is.Please tell us about your environment:
OS: Mac 10.15 and Windows 10
IDE: IntelliJ
Package manager: npm v6.14.8
Http server: nginx and webpack dev server (localhost)
Angular version: 10.1.5
PrimeNG version: 10.0.3
Browser:
We tested these desktop browsers: [ Chrome 86 | Firefox 82 | IE 11 | Safari 13 ]
Language: [all]
Node (for AoT issues):
node --version
= 14.15.0The text was updated successfully, but these errors were encountered: