Skip to content

Fix BottomSheet bottom bar automation IDs#913

Merged
Vetle444 merged 1 commit into
mainfrom
vefi/bugfix-bottomsheet-automationid
Jul 2, 2026
Merged

Fix BottomSheet bottom bar automation IDs#913
Vetle444 merged 1 commit into
mainfrom
vefi/bugfix-bottomsheet-automationid

Conversation

@Vetle444

@Vetle444 Vetle444 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description of Change

Fixes BottomSheet bottom bar button AutomationId handling so DUI no longer overwrites IDs supplied by consumers.

Why: MAUI only allows Element.AutomationId to be set once. Arena Mobil sets explicit automation IDs on bottom bar buttons, and BottomSheet.CreateBottomBar() later reassigned DUI-generated IDs while opening the sheet. That caused AutomationId may only be set one time, especially for sheets using ShowBottombarButtonsOnSubViews="True".

The bottom bar now generates DUI.BottomSheet.BottomBarButton{index} only when the button has no AutomationId, preserving consumer-provided IDs. A regression unit test verifies both preserved IDs and fallback generated IDs.

Verification:

  • dotnet test src/tests/unittests/DIPS.Mobile.UI.UnitTests.csproj --no-restore --filter FullyQualifiedName~BottomSheetTests --logger "console;verbosity=minimal"

Documentation:

  • No wiki update needed; this is a bug fix that preserves intended consumer behavior and does not add or change public API.

Todos

  • I have tested on an Android device.
  • I have tested on an iOS device.
  • I have supported accessibility

Copilot AI review requested due to automatic review settings July 2, 2026 10:28

Copilot AI left a comment

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.

Pull request overview

Fixes a MAUI AutomationId re-assignment issue in BottomSheet.CreateBottomBar() by only generating DUI automation IDs for bottom bar buttons that don’t already have a consumer-provided AutomationId. This prevents runtime exceptions (AutomationId may only be set one time) in scenarios where consumers pre-set IDs and the bottom bar is created later (e.g., with ShowBottombarButtonsOnSubViews="True").

Changes:

  • Updated BottomSheet.CreateBottomBar() to preserve existing AutomationId values and only generate fallback IDs when AutomationId is null.
  • Added a regression unit test to verify both preservation of consumer IDs and generation of fallback DUI IDs.
  • Added a patch entry to CHANGELOG.md describing the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

📁 File summary (3 files changed)
File Description
src/library/DIPS.Mobile.UI/Components/BottomSheets/BottomSheet.cs Guarded AutomationId assignment so consumer-provided IDs aren’t overwritten.
src/tests/unittests/Components/BottomSheets/BottomSheetTests.cs Regression test verifying preserved consumer IDs and generated fallback DUI IDs.
CHANGELOG.md Added 62.0.1 entry documenting the BottomSheet automation ID fix.

@Vetle444 Vetle444 enabled auto-merge (squash) July 2, 2026 10:32
@Vetle444 Vetle444 merged commit a933add into main Jul 2, 2026
2 checks passed
@Vetle444 Vetle444 deleted the vefi/bugfix-bottomsheet-automationid branch July 2, 2026 10:41
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