diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx index d3e41f8e58..d223f5b6a6 100644 --- a/src/components/views/spaces/SpacePanel.tsx +++ b/src/components/views/spaces/SpacePanel.tsx @@ -195,12 +195,10 @@ const InnerSpacePanel = React.memo(({ children, isPanelCo { (provided, snapshot) => ( , "title"> { +interface IButtonProps extends Omit, "title"> { space?: Room; className?: string; selected?: boolean; @@ -68,7 +70,9 @@ export const SpaceButton: React.FC = ({ ContextMenuComponent, ...props }) => { - const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu(); + const [menuDisplayed, ref, openMenu, closeMenu] = useContextMenu(); + const [onFocus, isActive, handle] = useRovingTabIndex(ref); + const tabIndex = isActive ? 0 : -1; let avatar =
; if (space) { @@ -88,6 +92,7 @@ export const SpaceButton: React.FC = ({ forceCount={false} notification={notificationState} aria-label={ariaLabel} + tabIndex={tabIndex} />
; } @@ -102,7 +107,7 @@ export const SpaceButton: React.FC = ({ } return ( - = ({ onContextMenu={openMenu} forceHide={!isNarrow || menuDisplayed} inputRef={handle} + tabIndex={tabIndex} + onFocus={onFocus} > { children }
@@ -130,7 +137,7 @@ export const SpaceButton: React.FC = ({ { contextMenu }
-
+ ); }; @@ -142,6 +149,7 @@ interface IItemProps extends InputHTMLAttributes { onExpand?: Function; parents?: Set; innerRef?: LegacyRef; + dragHandleProps?: DraggableProvidedDragHandleProps; } interface IItemState { @@ -290,6 +298,9 @@ export class SpaceItem extends React.PureComponent { aria-label={collapsed ? _t("Expand") : _t("Collapse")} /> : null; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { tabIndex, ...dragHandleProps } = this.props.dragHandleProps || {}; + return (
  • { role="treeitem" >