@@ -2,14 +2,14 @@ import { observer } from 'mobx-react';
2
2
import * as React from 'react' ;
3
3
4
4
import { ShelfIcon } from '../../common-elements/shelfs' ;
5
+ import type { IMenuItem } from '../../services' ;
5
6
import { OperationModel } from '../../services' ;
6
- import { shortenHTTPVerb } from '../../utils/openapi' ;
7
- import { MenuItems } from './MenuItems' ;
8
- import { MenuItemLabel , MenuItemLi , MenuItemTitle , OperationBadge } from './styled.elements' ;
9
7
import { l } from '../../services/Labels' ;
10
8
import { scrollIntoViewIfNeeded } from '../../utils' ;
9
+ import { shortenHTTPVerb } from '../../utils/openapi' ;
11
10
import { OptionsContext } from '../OptionsProvider' ;
12
- import type { IMenuItem } from '../../services' ;
11
+ import { MenuItems } from './MenuItems' ;
12
+ import { MenuItemLabel , MenuItemLi , MenuItemTitle , OperationBadge } from './styled.elements' ;
13
13
14
14
export interface MenuItemProps {
15
15
item : IMenuItem ;
@@ -47,9 +47,18 @@ export class MenuItem extends React.Component<MenuItemProps> {
47
47
< MenuItemLi
48
48
tabIndex = { 0 }
49
49
onClick = { this . activate }
50
+ onKeyDown = { evt => {
51
+ // Space or Enter key will activate the menu item
52
+ if ( evt . key === 'Enter' || evt . key === ' ' ) {
53
+ this . props . onActivate ! ( this . props . item ) ;
54
+ evt . stopPropagation ( ) ;
55
+ }
56
+ } }
50
57
depth = { item . depth }
51
58
data-item-id = { item . id }
52
59
role = "menuitem"
60
+ aria-label = { item . sidebarLabel }
61
+ aria-expanded = { item . expanded }
53
62
>
54
63
{ item . type === 'operation' ? (
55
64
< OperationMenuItemContent { ...this . props } item = { item as OperationModel } />
0 commit comments