Skip to content
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

[datetime] fix(TimePicker): improve a11y markup #5397

Merged
merged 8 commits into from
Jul 7, 2022

Conversation

bvandercar-vt
Copy link
Contributor

Fixes #0000

Checklist

  • [N/A] Includes tests
  • [N/A] Update documentation

Changes proposed in this pull request:

Reviewers should focus on:

Spinbutton example: https://w3c.github.io/aria-practices/examples/spinbutton/datepicker-spinbuttons.html

packages/datetime/src/timePicker.tsx Show resolved Hide resolved
packages/datetime/src/timePicker.tsx Outdated Show resolved Hide resolved
<span tabIndex={-1} className={classes} onClick={onClick}>
<span
aria-controls={this.timeInputIds[timeUnit]}
aria-label={`${isDirectionUp ? "Increase" : "Decrease"} ${timeUnit}`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's good that you included the time unit here, but it looks like it will not print nicely for some of the units. can you create a helper function in timeUnit.ts to pretty print the time unit enum? something like:

/** Prints a descriptive label representing the plural of th given time unit. */
export function printTimeUnit(unit: TimeUnit) {
    return {
        [TimeUnit.HOUR_24]: "hours (24hr clock)",
        [TimeUnit.HOUR_12]: "hours (12hr clock)",
        [TimeUnit.MINUTE]: "minutes",
        [TimeUnit.SECOND]: "seconds",
        [TimeUnit.MS]: "milliseconds",
    }[unit];
}

... and then use that helper function in this label value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@adidahiya adidahiya changed the title improve timePicker a11y [datetime] fix(TimePicker): improve a11y Jun 23, 2022
@adidahiya adidahiya changed the title [datetime] fix(TimePicker): improve a11y [datetime] fix(TimePicker): improve a11y markup Jul 7, 2022
@adidahiya adidahiya merged commit 7916db8 into palantir:develop Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants