Add focus option to context menu in the accessibility tree

Summary: Allow user to open the context menu on an element in the ax tree and request accessibility focus to that element. If the element is focusable (and talkback or another accessibility service is running), accessibility focus will change to that element, if not, it will not change anything.

Differential Revision: D9162382

fbshipit-source-id: 5dda9b87a2cc6eba4130e3feee978b5fa38ac9f1
This commit is contained in:
Sara Valderrama
2018-08-07 09:35:13 -07:00
committed by Facebook Github Bot
parent ae0b8f6b53
commit 1fb2c4ee76
5 changed files with 58 additions and 2 deletions

View File

@@ -791,6 +791,17 @@ export default class Layout extends SonarPlugin<InspectorState> {
});
});
getAXContextMenuExtensions() {
return [
{
label: 'Focus',
click: (id: ElementID) => {
this.client.send('onRequestAXFocus', {id});
},
},
];
}
onDataValueChanged = (path: Array<string>, value: any) => {
const selected = this.state.inAXMode
? this.state.AXselected
@@ -935,6 +946,7 @@ export default class Layout extends SonarPlugin<InspectorState> {
searchResults={null}
root={AXroot}
elements={AXelements}
contextMenuExtensions={this.getAXContextMenuExtensions()}
/>
) : null}
</FlexRow>