Commit 8821a08
Fix Narrator silence on PipsPager page navigation (#2093)
## Fix Narrator announcement for PipsPager page changes
- [x] Initialize TestPipsPager2 with NumberOfPages property
- [x] Implement SelectedIndexChanged event handler for narrator
announcements
- [x] Use UIHelper.AnnounceActionForAccessibility for programmatic
narrator announcements
- [x] Enhance announcement format to include total page count
- [x] Extract notification ID to a constant for maintainability
- [x] Run code review to validate changes
- [x] Run CodeQL security check
## Summary
This PR fixes an accessibility issue where the Narrator screen reader
remained silent when users clicked the Next/Previous page buttons on the
PipsPager control in the WinUI 3 Gallery app.
### Changes Made:
1. **Initialized PipsPager**: Set NumberOfPages="10" on TestPipsPager2
to provide a working example
2. **Implemented event handler**: Added SelectedIndexChanged handler
that uses `UIHelper.AnnounceActionForAccessibility()` to
programmatically announce page changes to screen readers
3. **Enhanced announcement format**: Changed from "Page X selected" to
"Page X of Y selected" to provide users with context about their
position and the total number of pages
4. **Code quality improvement**: Extracted notification ID to a private
constant (`PipsPagerPageChangeNotificationId`) for better
maintainability and to prevent typos
5. **No visible UI changes**: Uses AutomationPeer.RaiseNotificationEvent
internally (via UIHelper) to announce without adding visible text
elements
### Technical Implementation:
The solution uses `UIHelper.AnnounceActionForAccessibility()` which
internally calls `AutomationPeer.RaiseNotificationEvent()` with
`AutomationNotificationKind.ActionCompleted`. This approach follows the
pattern used throughout the WinUI Gallery codebase (AppBarButtonPage,
BreadcrumbBarPage, ClipboardPage, etc.) for making narrator
announcements without requiring visible UI elements.
### Accessibility Impact:
Users who rely on screen readers will now hear "Page X of Y selected"
when navigating through pages using the Next/Previous buttons, meeting
MAS 4.2.12 accessibility requirements, without any visible UI changes to
the PipsPager control. The enhanced format provides better context by
including the total page count.
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Upon selecting Next page/Previous page, Narrator remains
silent</issue_title>
> <issue_description>### Which version of the app?
>
> WinUI 3 Gallery
>
> ### Description
>
> Environment Details:
> OS Version: 24H2 (OS Build 26100.4315)
> App: WinUI 3 Gallery
> App Version: 2.6.0.0 (SDK 1.7)
> AT: Color Contrast
>
> Repro Steps:
> Launch the WinUI 3 Gallery app.
> Navigate to search box using tab key.
> Type 'Pipspager' in search box and activate it.
> Now navigate to 'Next/Previous page' button under 'Pipspager with
options to change its orientation and button visibility'. And activate
it. Observe Narrator announcement.
> Actual Result:
> Upon selecting Next page/Previous page, Narrator remains silent
Instead of announcing the appeared page information and focused element
information.
>
> Expected Result:
> Upon selecting Next page/Previous page, Narrator should not remain
silent, Instead it should announce the selected page Like, Page 5
selected.
>
> User impact:
> Users who rely on Screen reader will face difficulty in understanding
the updated page information.
>
> MAS Reference Link: [MAS 4.2.12 – Change
Notification](https://aka.ms/MAS4.2.12)
>
> Trap ID: [1.9 - Feedback Failure](https://aka.ms/FeedbackFailure)
>
> “Have feedback on bugs logged, please tag bug as “A11yRCA” and add
your feedback in the comment section.”
>
> ### Screenshots
>
> _No response_
>
> ### Windows version
>
> Windows 11 24H2 (26100)
>
> ### Additional context
>
> _No response_</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #2086
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ayushjai19 <244442986+ayushjai19@users.noreply.github.com>1 parent 18bdae8 commit 8821a08
File tree
2 files changed
+15
-1
lines changed- WinUIGallery/Samples/ControlPages
2 files changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
27 | 38 | | |
28 | 39 | | |
29 | 40 | | |
| |||
0 commit comments