Skip to content

Commit

Permalink
Support grouped focus for switch (#40739)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #40739

Adding support for grouped accessibility focus on switch.  This is when the switch itself shouldn't be directly focusable.  Instead, the parent element should be focusable, including announcing the switch role and state changes, e.g. "on" and "off".

Fix this issue in a couple ways:
1. Make sure to set the proper role for switch in FbReactSwitchCompat.java.
2. Set the state description in SwitchCompat.java so that uses the correct announcement of "off" and "on" instead of "checked" and "unchecked".

Reviewed By: blavalla

Differential Revision: D50068169

fbshipit-source-id: 0c4133377f7a29da9cadb730399bdbedd58c26ae
  • Loading branch information
carmenvkrol authored and facebook-github-bot committed Oct 9, 2023
1 parent ec1de61 commit 06c295c
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,6 @@ private static void setState(
final boolean boolValue = value.asBoolean();
info.setCheckable(true);
info.setChecked(boolValue);
if (info.getClassName().equals(AccessibilityRole.getValue(AccessibilityRole.SWITCH))) {
info.setStateDescription(
context.getString(
boolValue ? R.string.state_on_description : R.string.state_off_description));
}
}
}
}
Expand Down

0 comments on commit 06c295c

Please sign in to comment.