Skip to content

feat(datetime): localize am/pm labels in time picker #25389

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

Merged
merged 35 commits into from
Jun 14, 2022
Merged

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Jun 1, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The labels for "am" and "pm" are not localized to the user's current locale. This means in locales that either do not use am/pm in their time selection or have alternative labels, the text is incorrect.

This also affects the initial display of the time value, when using a presentation mode that opens the time picker in a popover.

Issue URL: #16279

What is the new behavior?

  • The am/pm labels within the time picker (popover) are localized to the user's locale
  • The value displayed within the time picker, when using a presentation mode that presents the time picker in a popover, is localized.
  • The width of the popover will respond to grow to account for languages that have am/pm label representations that are longer than the standard width and would cause overflow.
  • Locales that format the day period at the beginning of the label, will display the day period as the first column in the time picker
  • Migrates the locale datetime tests from puppeteer to playwright.

Example of the change with a locale of: ta-IN:

iOS MD
Screen Shot 2022-06-07 at 1 46 36 PM Screen Shot 2022-06-07 at 1 46 52 PM

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev-build: 6.1.8-dev.11654624050.16b62b1b (outdated)

@sean-perkins sean-perkins requested a review from a team June 1, 2022 20:37
@github-actions github-actions bot added the package: core @ionic/core package label Jun 1, 2022
@sean-perkins sean-perkins changed the title feat(time): localize am/pm labels in time picker feat(datetime): localize am/pm labels in time picker Jun 2, 2022
Copy link
Contributor

@averyjohnston averyjohnston left a comment

Choose a reason for hiding this comment

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

Some of the ta-IN screenshots show time picker popovers that are too narrow:

  • core/src/components/datetime/test/locale/datetime.e2e.ts-snapshots/datetime-locale-ta-IN-time-diff-md-ltr-Mobile-Chrome-linux.png
  • core/src/components/datetime/test/locale/datetime.e2e.ts-snapshots/datetime-locale-ta-IN-time-diff-md-ltr-Mobile-Firefox-linux.png
  • core/src/components/datetime/test/locale/datetime.e2e.ts-snapshots/datetime-locale-ta-IN-time-diff-md-rtl-Mobile-Chrome-linux.png
  • core/src/components/datetime/test/locale/datetime.e2e.ts-snapshots/datetime-locale-ta-IN-time-diff-md-rtl-Mobile-Firefox-linux.png

Not sure if that's a screenshot timing issue or an actual bug, though.

Also, don't forget to remove the old e2e.ts file.

@liamdebeasi liamdebeasi self-requested a review June 2, 2022 18:52
@sean-perkins
Copy link
Contributor Author

Still working through the popover sizing (specifically on iOS). Will re-ping for reviews once I get that resolved 🤔

Copy link
Contributor

@averyjohnston averyjohnston left a comment

Choose a reason for hiding this comment

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

(Whoops, clicked approve when I meant comment 😆)

Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Great job!

@sean-perkins
Copy link
Contributor Author

It looks like when we updated picker column internal to make the rendered items buttons, we broke keyboard navigation across the columns (using tab to move across columns).

Now when tabbing through the interface, you move through each individual button, column by column.

Thoughts on what we can do here? I know our motivation for swapping it to a button was for screen readers. Would role="button" be a bad move here?

@liamdebeasi
Copy link
Contributor

I think we should be able to add a tabindex="-1" to the button element. That would allow developers to use Tab to switch between columns but still use the arrow keys to navigate up and down within a column.

I will test more today and put up a PR. (along with tests)

@liamdebeasi
Copy link
Contributor

Ok PR is up: #25464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants