Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const KeyNameByModifierAttr = {
shiftKey: 'Shift',
};

const overriddenKeyCodes = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
const overriddenKeyCodes = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Tab'];

interface KeyboardCommand {
area: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/** @jsx jsx */
import { jsx, css } from '@emotion/core';
import { FC, useContext, useCallback } from 'react';
import { FC, useContext, useCallback, useEffect } from 'react';
import { generateActionTitle, PromptTab } from '@bfc/shared';
import { useShellApi } from '@bfc/extension-client';

Expand Down Expand Up @@ -38,6 +38,7 @@ export const ActionNodeWrapper: FC<NodeWrapperProps> = ({ id, tab, data, onEvent
const nodeFocused = focusedId === id || focusedEvent === id;
const nodeDoubleSelected = tab && nodeFocused && tab === focusedTab;
const nodeSelected = selectedIds.includes(id);
const nodeId = `action-${selectableId}`;

const declareElementAttributes = (selectedId: string, id: string) => {
return {
Expand All @@ -58,6 +59,13 @@ export const ActionNodeWrapper: FC<NodeWrapperProps> = ({ id, tab, data, onEvent
addCoachMarkRef({ action });
}, []);

useEffect(() => {
if (nodeSelected || nodeDoubleSelected) {
const actionNode = document.getElementById(nodeId);
actionNode?.focus();
}
}, [nodeSelected, tab, nodeDoubleSelected]);

// Set 'use-select' to none to disable browser's default
// text selection effect when pressing Shift + Click.
return (
Expand All @@ -75,6 +83,8 @@ export const ActionNodeWrapper: FC<NodeWrapperProps> = ({ id, tab, data, onEvent
}
`}
data-testid="ActionNodeWrapper"
id={nodeId}
tabIndex={0}
{...declareElementAttributes(selectableId, id)}
aria-label={generateActionTitle(data, '', '', tab)}
onClick={(e) => {
Expand Down