Keyboard controls moved selected and hovered node together

Summary:
Following feedback when using keyboard controls its a little bit awkward to have to move with arrows and then select with enter.

Now when using keyboard controls you are manipulating the selected state.

Enter still selects / unselects but its not really needed anymore

When using the mouse the hover state is still there

Changelog: [UIDebugger] Using keyboard arrow control changes the selected and hovered state together for faster / easier navigation

Reviewed By: lblasa

Differential Revision: D47212492

fbshipit-source-id: 996196880d623885b4d4b7d1a70954201f809d28
This commit is contained in:
Luke De Feo
2023-07-10 09:22:39 -07:00
committed by Facebook GitHub Bot
parent f3f5018f71
commit 36447d550a
2 changed files with 44 additions and 21 deletions

View File

@@ -372,7 +372,7 @@ export function plugin(client: PluginClient<Events>) {
}
type UIActions = {
onHoverNode: (node: Id) => void;
onHoverNode: (node?: Id) => void;
onFocusNode: (focused?: Id) => void;
onContextMenuOpen: (open: boolean) => void;
onSelectNode: (node?: Id) => void;
@@ -418,8 +418,12 @@ function uiActions(uiState: UIState, nodes: Atom<Map<Id, UINode>>): UIActions {
});
};
const onHoverNode = (node: Id) => {
uiState.hoveredNodes.set([node]);
const onHoverNode = (node?: Id) => {
if (node != null) {
uiState.hoveredNodes.set([node]);
} else {
uiState.hoveredNodes.set([]);
}
};
const onContextMenuOpen = (open: boolean) => {