feat: enable keyboard navigation (#2361)

This commit is contained in:
Roman Pidkostelnyi 2023-07-19 14:45:12 +03:00 committed by GitHub
parent 8fbc955f12
commit d21af58414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,13 @@ export class MenuItem extends React.Component<MenuItemProps> {
render() { render() {
const { item, withoutChildren } = this.props; const { item, withoutChildren } = this.props;
return ( return (
<MenuItemLi onClick={this.activate} depth={item.depth} data-item-id={item.id} role="menuitem"> <MenuItemLi
tabIndex={0}
onClick={this.activate}
depth={item.depth}
data-item-id={item.id}
role="menuitem"
>
{item.type === 'operation' ? ( {item.type === 'operation' ? (
<OperationMenuItemContent {...this.props} item={item as OperationModel} /> <OperationMenuItemContent {...this.props} item={item as OperationModel} />
) : ( ) : (
@ -96,7 +102,7 @@ export const OperationMenuItemContent = observer((props: OperationMenuItemConten
) : ( ) : (
<OperationBadge type={item.httpVerb}>{shortenHTTPVerb(item.httpVerb)}</OperationBadge> <OperationBadge type={item.httpVerb}>{shortenHTTPVerb(item.httpVerb)}</OperationBadge>
)} )}
<MenuItemTitle width="calc(100% - 38px)"> <MenuItemTitle tabIndex={0} width="calc(100% - 38px)">
{item.sidebarLabel} {item.sidebarLabel}
{props.children} {props.children}
</MenuItemTitle> </MenuItemTitle>