From d6ccf74c379bb37deafad19c051904be8706e878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Fri, 10 May 2019 06:16:07 -0700 Subject: [PATCH] focus from context menu Summary: Add option to focus a view from the context menu. Reviewed By: passy Differential Revision: D15294182 fbshipit-source-id: f03db136e8365833beee3b4883d2114e98a280bd --- src/plugins/layout/Inspector.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/layout/Inspector.js b/src/plugins/layout/Inspector.js index 0ca405dfa..d36899f27 100644 --- a/src/plugins/layout/Inspector.js +++ b/src/plugins/layout/Inspector.js @@ -78,6 +78,18 @@ export default class Inspector extends Component { ?.id; }; + getAXContextMenuExtensions = () => + this.props.ax + ? [ + { + label: 'Focus', + click: (id: ElementID) => { + this.props.client.call('onRequestAXFocus', {id}); + }, + }, + ] + : []; + componentDidMount() { this.props.client.call(this.call().GET_ROOT).then((root: Element) => { this.props.setPersistedState({ @@ -257,6 +269,7 @@ export default class Inspector extends Component { root={this.root()} elements={this.elements()} focused={this.focused()} + contextMenuExtensions={this.getAXContextMenuExtensions()} /> ) : null; }