-
Notifications
You must be signed in to change notification settings - Fork 77
feat: keyboard navigation in calendar #858
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
Conversation
|
Deploy preview for fundamental-react ready! Built with commit 6a466a4 |
| .locale(this.props.locale) | ||
| .month(month) | ||
| .date(1); | ||
| .month(month); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
careful: This was probably put in place so that you don't accidentally jump from 1/31/2020 to 2/31/2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With moment, it will now set it to the latest day if the new month doesn't have enough days. Can go either way on this though.
|
When I use PAGEUP/PAGEDOWN it selects the day it lands on in the next/previous month, even if I had already selected a day. Another note is the odd interaction at first. I did a shift-tab back into the calendar and it put my focus on Feb 1 at first, but hitting left arrow got me on Jan 30 instead of Jan 31. I haven't been able to repro though. |
|
Not specifically related to keyboard navigation, but when going from April 2020 to May 2020, the size of the calendar grows because of how the days line up. There are actually 6 weeks with days in May. Should we add something such that 6 weeks always show in the Calendar (and then DatePicker) so there is no "jumping"? |
|
Overall, it seems pretty good. Some random thoughts/observations:
|
For sure. May probably take another stab at changing Calendar's popover to a Popover.
I don't see a specification in Fiori for always showing 6 weeks, and I would think it would be odd to include an extra week entirely from the next month if the month only has 5 weeks. What some other date pickers do is leave space for 6 weeks, but not show the last week; but again, there's no specification for what that would look like.
These are styles issues that were not initially made in the first pass through changing calendar styles, because there wasn't a spec for focus indication in Fiori. I just opted to use the hover style, which isn't ideal in hindsight. This PR (SAP/fundamental-styles#506) seems to have a good solution for focus styles. We should address that upgrade in a separate change.
If PGUP/PGDN changed the year in the year view, then we probably have to change what SHIFT+PGUP/PGDN does too. I'm not sure making those keys do the same thing, do nothing, or making it change the month is a good idea.
I think changing the month and year views to popover would be quite a big refactor (needing to remove the box shadow, trying to make it work within the Calendar popover, etc.). Ultimately other date pickers I have seen just close the whole widget altogether if there is a separate month/year picker, which doesn't seem to be a bad idea. |
|
@jacobdevera - its important to have a static height for the calendar, otherwise, while flipping through the months in a near page edge situations, popper will flip the calendar up when it encounters 6 weeks, and flip back when it goes back to 5 weeks. a static height assures that popper wont reposition the calendar while navigating through months. |
| mount(compactRangeDatepicker); | ||
| }); | ||
|
|
||
| test('open/close by calendar icon button', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These essentially test opening/closing the calendar which should now be covered by using the Popover component itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
jbadan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my comment have been addressed 🚢
|
Once you merge latest master into here, can you also remove these lines: https://github.com/SAP/fundamental-react/blob/master/src/DatePicker/DatePicker.js#L25 Because you replaced the hardcoded html for popover in here with the actual Popover component, it doesn't need this style block again |


Description
Adds the following characteristics to Calendar:
Known issues
Desired
Use Popover for DatePicker to allow for Escape to close the popover, and trap focus within the Calendar: some issues with date validation currently that is making this difficult
Announce instructions for arrow key navigation: accessibility-wise, it's best for this to be onscreen and recognizable by both sighted and blind users, though if we want to hide this, would probably require a styles update.
References
https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/datepicker-dialog.html
Fixes
fixes #829 & #827 & #787