Skip to content

Commit

Permalink
use setContentDescription for controls on Android (flutter#6050)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahwilliams authored Aug 20, 2018
1 parent 9cf8028 commit c23690f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,22 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
result.setCheckable(hasCheckedState || hasToggledState);
if (hasCheckedState) {
result.setChecked(object.hasFlag(Flag.IS_CHECKED));
result.setContentDescription(object.getValueLabelHint());
if (object.hasFlag(Flag.IS_IN_MUTUALLY_EXCLUSIVE_GROUP))
result.setClassName("android.widget.RadioButton");
else
result.setClassName("android.widget.CheckBox");
} else if (hasToggledState) {
result.setChecked(object.hasFlag(Flag.IS_TOGGLED));
result.setClassName("android.widget.Switch");
result.setContentDescription(object.getValueLabelHint());
} else {
// Setting the text directly instead of the content description
// will replace the "checked" or "not-checked" label.
result.setText(object.getValueLabelHint());
}

result.setSelected(object.hasFlag(Flag.IS_SELECTED));
result.setText(object.getValueLabelHint());

// Accessibility Focus
if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) {
Expand Down

0 comments on commit c23690f

Please sign in to comment.