-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
fix: add missing accessibility attributes, fixes #233 #296
Conversation
(self.locale.weekday as string[]).push(capitalizeFirstLetter(weekday)); | ||
(self.locale.longWeekday as string[]).push(capitalizeFirstLetter(longWeekday)); |
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.
another option might be to keep both long/short weekday in a single array of objects, but that might be a breaking change, so perhaps acceptable for 3.0 roadmap?
const weekday = [{ long: 'Monday', short: 'Mon' }, ...]
or yet another option would be to keep only the long version and then do a substring of the first 3 chars, but I don't know if that is valid for all locale? maybe not
@@ -3,8 +3,9 @@ import getComponent from '@scripts/helpers/getComponent'; | |||
|
|||
export const DOMParser = (self: VanillaCalendar, template: string) => ( | |||
template.replace(/[\n\t]/g, '').replace(/<#(?!\/?Multiple)(.*?)>/g, (_, p1) => { | |||
const component = getComponent(p1.replace(/[/\s\n\t]/g, '')); | |||
const html = component ? component(self) : ''; | |||
const [__, comp, attribute] = /(.*)\s?\[(.*)\].*/g.exec(p1) || []; |
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.
I'm sure this regex could be improved and perhaps merged with the regex just above on the previous line but I played it safe and couldn't figure out the best regex to use, feel free to change. The regex is to extract any optional attribute that I added to some of the component like <#ArrowPrev [month] />
or <#ArrowPrev [year] />
There is definitely no need to create a |
All good, I just provided this code as a guideline, feel free to change it all the way you want for 3.0. Another thing that we could potentially do in the future, though it's just an idea, we could listen to keyboard arrows to allow selecting a date without ever touching the mouse. Below is an example from Flatpickr (the previous date picker I was using) |
Yes, there will be control with the help of arrows, too, it was in the plans. |
Implemented in v3.0.0 #293 |
fixes #233
aria-label
to a few elements"long"
read of weekday from locale, perhaps we could use it for short too with a substring of 3 chars?)<#ArrowPrev [year] />
whichyear
is the optional attribute which is then used to readself.ariaLabels.nextMonth
)aria-selected
to all dates and also month and/or year pickerI think that this should be enough to make the picker more accessible and close the associated issue :)