Skip to content

Add semantic properties for the Toolbar BackButton #17984

@PureWeen

Description

@PureWeen

Description

Currently it's tricky to modify the text you want read out for the BackButton, if you want it to differ from what you've set for the BackButtonBehavior (Shell) or the NavigationPage.SetBackButtonTitle.

We should add some additional properties to modify the semantic text for the back button.

Steps to Reproduce

Scenario 1 – Shell Navigation (GoToAsync + BackButtonBehavior)

  • Launch the app — lands on MainPage Sample1.zip
  • Tap "GoToAsync → DetailPage (Shell + BackButtonBehavior)"
  • Navigates to DetailPage via Shell routing
  • Back button visually shows "Override" (set using BackButtonBehavior.TextOverride)
  • Focus the back button using VoiceOver/TalkBack

Scenario 2 – NavigationPage (PushAsync + SetBackButtonTitle)

  • From MainPage, tap "PushAsync → SecondPage (NavigationPage.SetBackButtonTitle)"
  • A modal NavigationPage opens, displaying NavHomePage
  • Tap "PushAsync → SecondPage"
  • Navigates to SecondPage — back button visually shows "BackTitle"
  • Focus the back button using VoiceOver/TalkBack

Workaround

One workaround on Android would be to do this

#if ANDROID
     ToolbarHandler.Mapper.AppendToMapping(nameof(IToolbar.BackButtonVisible), (handler, view) =>
     {
          handler.PlatformView.NavigationContentDescription = "text";
     });

     ToolbarHandler.Mapper.AppendToMapping(nameof(Toolbar.BackButtonTitle), (handler, view) =>
     {
          handler.PlatformView.NavigationContentDescription = "text";
     });
#endif
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions