Skip to content

[iOS BottomSheetController] Fix logic that creates/updates the bottomSheetView accessibilityIdentifier#2210

Merged
nodes11 merged 2 commits intomicrosoft:mainfrom
nodes11:fix_bottom_sheet_accessibility_identifier_logic
Sep 19, 2025
Merged

[iOS BottomSheetController] Fix logic that creates/updates the bottomSheetView accessibilityIdentifier#2210
nodes11 merged 2 commits intomicrosoft:mainfrom
nodes11:fix_bottom_sheet_accessibility_identifier_logic

Conversation

@nodes11
Copy link
Copy Markdown
Contributor

@nodes11 nodes11 commented Sep 18, 2025

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

I observed that bottomSheetView's accessibilityIdentifier was incorrect when the sheet entered the expanded state. The root cause is that the methods which append strings to the identifier can be invoked multiple times without checking whether the substring already exists, which leads to the incorrect identifier.

Screenshot 2025-09-18 at 2 15 47 PM

Fix:

  • A private method bottomSheetViewAccessibilityIdentifierForState that performs the necessary state checks and returns the correct accessibilityIdentifier for bottomSheetView.
  • Replace every place that previously appended substrings to bottomSheetView.accessibilityIdentifier with a call to bottomSheetViewAccessibilityIdentifier

Binary change

NA

Verification

I valided using the debugger that the bottomSheetView accessibilityIdentifier is set correctly for each of the different states.

I validated that the BottomSheetControllerTest XCUI tests pass with the changes in place.

Visual Verification
Before After

|
Screenshot 2025-09-18 at 2 15 47 PM | Screenshot 2025-09-18 at 2 27 31 PM |

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)

@nodes11 nodes11 requested a review from a team as a code owner September 18, 2025 21:33
@joannaquu
Copy link
Copy Markdown
Contributor

I believe these were added for xcuitests, pipelines will catch it but I'd double check locally

@nodes11
Copy link
Copy Markdown
Contributor Author

nodes11 commented Sep 18, 2025

The BottomSheetControllerTest tests pass with the changes. Updated verification section with this detail.

@nodes11 nodes11 enabled auto-merge (squash) September 18, 2025 22:39
@nodes11 nodes11 merged commit b19ff5b into microsoft:main Sep 19, 2025
12 of 13 checks passed
@nodes11 nodes11 deleted the fix_bottom_sheet_accessibility_identifier_logic branch September 25, 2025 15:07
@joannaquu joannaquu mentioned this pull request Oct 23, 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.

2 participants