Skip to content

[macOS] Announce DatePickerController changes in VoiceOver#2134

Merged
mischreiber merged 6 commits intomicrosoft:mainfrom
mischreiber:announceDatePickerChanges
Mar 19, 2025
Merged

[macOS] Announce DatePickerController changes in VoiceOver#2134
mischreiber merged 6 commits intomicrosoft:mainfrom
mischreiber:announceDatePickerChanges

Conversation

@mischreiber
Copy link
Copy Markdown
Collaborator

@mischreiber mischreiber commented Feb 20, 2025

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

  • Create a new NSAccessibilityStepper for the header, making it possible to read and change the value of the header as one entire element.
  • Add an NSAccessibility announcement when the visible month in the DatePickerController changes.
  • Clean up TestDatePickerController so popover-hosted picker works as expected.

Binary change

n/a, no Mac size testing

Verification

  • Verified VoiceOver announcements happen for all three date pickers in the test screen.
  • Ensured announcements happen exactly once, and only when the picker changes (not on initial appearance).
Stepper.mov

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)
Microsoft Reviewers: Open in CodeFlow

@mischreiber mischreiber requested a review from a team as a code owner February 20, 2025 23:32
@mischreiber mischreiber merged commit 4c0c69b into microsoft:main Mar 19, 2025
7 checks passed
@mischreiber mischreiber deleted the announceDatePickerChanges branch March 19, 2025 22:35
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: Should be preconditionFailure per https://lapcatsoftware.com/articles/fatalError.html. And can also mark func as unavailable?

self.setAccessibilityRole(.incrementor)

self.addView(monthYearLabel, in: .center)
self.addView(leadingButton, in: .leading)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we mark these nested controls as not accessibility elements to match OS pattern of stepper elements not having children?

@joannaquu joannaquu mentioned this pull request Apr 4, 2025
12 tasks
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.

3 participants