Accessibility Identifier of UIBarButtonItem

Hi Team,
I am trying to setup accessibility identifier for backBarButtonItem.

I can not see the identifier in Accessibility Inspector.

Here are my findings:-
  1. UIBarButtonItem is derived from UIBarItem which confirms the protocol UIAccessbilityIdentification.

  2. Setting isAccessibilityElement to true does not work.

Here is my code

Code Block
   func setUpBarButton() {
    let backButtonImage = UIImage(named: "icon-backarrow")
    previousViewController?.navigationController?.navigationBar.backIndicatorImage = backButtonImage
    previousViewController?.navigationController?.navigationBar.backIndicatorTransitionMaskImage = backButtonImage
    let backButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
    backButtonItem.isAccessibilityElement = true
    backButtonItem.accessibilityIdentifier = "leftItem"
    previousViewController?.navigationItem.backBarButtonItem = backButtonItem
  }


What can be the reason for not showing identifier?


Accessibility Identifier of UIBarButtonItem
 
 
Q