Fix BottomSheet bottom bar automation IDs#913
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 existingAutomationIdvalues and only generate fallback IDs whenAutomationIdisnull. - Added a regression unit test to verify both preservation of consumer IDs and generation of fallback DUI IDs.
- Added a patch entry to
CHANGELOG.mddescribing 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. |
VegardHV
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Fixes BottomSheet bottom bar button
AutomationIdhandling so DUI no longer overwrites IDs supplied by consumers.Why: MAUI only allows
Element.AutomationIdto be set once. Arena Mobil sets explicit automation IDs on bottom bar buttons, andBottomSheet.CreateBottomBar()later reassigned DUI-generated IDs while opening the sheet. That causedAutomationId may only be set one time, especially for sheets usingShowBottombarButtonsOnSubViews="True".The bottom bar now generates
DUI.BottomSheet.BottomBarButton{index}only when the button has noAutomationId, 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:
Todos