mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): NavigationButton was read as "Button" by screenreaders. (#5949)
The navigation button for the vision-impaired users were always read as: "Button" by the TalkBack service on Android.
This commit is contained in:
committed by
Alexander Vakrilov
parent
b0afd3ab30
commit
0e04cb4ad1
@@ -223,6 +223,9 @@ export class ActionBar extends ActionBarBase {
|
||||
this.nativeViewProtected.setNavigationIcon(drawableOrId);
|
||||
}
|
||||
|
||||
// Set navigation content descripion, used by screen readers for the vision-impaired users
|
||||
this.nativeViewProtected.setNavigationContentDescription(navButton.text || null);
|
||||
|
||||
let navBtn = new WeakRef(navButton);
|
||||
this.nativeViewProtected.setNavigationOnClickListener(new android.view.View.OnClickListener({
|
||||
onClick: function (v) {
|
||||
@@ -285,7 +288,7 @@ export class ActionBar extends ActionBarBase {
|
||||
let menuItem = menu.add(android.view.Menu.NONE, item._getItemId(), android.view.Menu.NONE, item.text + "");
|
||||
|
||||
if (item.actionView && item.actionView.android) {
|
||||
// With custom action view, the menuitem cannot be displayed in a popup menu.
|
||||
// With custom action view, the menuitem cannot be displayed in a popup menu.
|
||||
item.android.position = "actionBar";
|
||||
menuItem.setActionView(item.actionView.android);
|
||||
ActionBar._setOnClickListener(item);
|
||||
@@ -376,7 +379,7 @@ export class ActionBar extends ActionBarBase {
|
||||
}
|
||||
|
||||
// Fallback to hardcoded falue if we don't find TextView instance...
|
||||
// using new TextView().getTextColors().getDefaultColor() returns different value: -1979711488
|
||||
// using new TextView().getTextColors().getDefaultColor() returns different value: -1979711488
|
||||
defaultTitleTextColor = tv ? tv.getTextColors().getDefaultColor() : -570425344;
|
||||
}
|
||||
|
||||
@@ -468,4 +471,4 @@ function getIconVisibility(iconVisibility: string): boolean {
|
||||
|
||||
function getSystemResourceId(systemIcon: string): number {
|
||||
return android.content.res.Resources.getSystem().getIdentifier(systemIcon, "drawable", "android");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user