-
Notifications
You must be signed in to change notification settings - Fork 1.2k
DatePicker goes backward through segments on Enter #5102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I see that. Looks like it is caused by https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/datepicker/src/useDatePickerGroup.ts#L97 I'm not sure this is a bug, if you were on the last segment of an empty field and pressed Enter, would it just stay on that last segment? It seems more useful for it to go to the first, that way a user can fill in each segment and the field will auto advance as the user types. |
I think that makes sense for when all fields are empty. But, the issue we are having in production is that when all of the fields are filled in and you press Enter, instead of taking you to the next focusable element outside of the date field, it takes you to the second to last segment. |
Related: #5032 |
That's precisely what I'm facing in prod. In my case, I have only a date field in the form once I filled all segments and pressed Enter I'm expecting to submit the form instead of backing a segment. |
Is there any workarounds to this issue? |
No workarounds short of modifying the press handler that @snowystinger shared via something like patch-package that I can think of. |
We would also accept a PR if you wanted to address this. See our contributing guide https://react-spectrum.adobe.com/contribute.html |
Is there an update on this? |
so unfortunate to see this bug still exists 🙁, I'm also having an issue w/ this |
Provide a general summary of the issue here
When the user hits Enter, the date picker focus moves from the last to the first date segment.
🤔 Expected Behavior?
The user should be able to hit enter and traverse through the segments and through to the next field.
😯 Current Behavior
The date picker focus moves from the last to the first date segment and you cannot get to the next field by hitting Enter in a form.
💁 Possible Solution
Add logic for the enter key to move focus through the segments.
🔦 Context
No response
🖥️ Steps to Reproduce
Go to the example: https://react-spectrum.adobe.com/react-aria/useDatePicker.html
Click on
mm
and hit Enter. See that it does nothing.Tab to the year segment and hit Enter. See that it goes backward to the beginning.
Version
3.26.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Mac OS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: