1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Work towards unifying KeyboardShortcuts and KeyBindingsDefaults #2 (#7674)

This commit is contained in:
Šimon Brandner
2022-01-31 16:55:45 +01:00
committed by GitHub
parent 7e5de9294c
commit a17d585a12
15 changed files with 450 additions and 732 deletions

View File

@ -37,11 +37,12 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
import AccessibleButton, { ButtonEvent } from "../elements/AccessibleButton";
import { StaticNotificationState } from "../../../stores/notifications/StaticNotificationState";
import { NotificationColor } from "../../../stores/notifications/NotificationColor";
import { getKeyBindingsManager, RoomListAction } from "../../../KeyBindingsManager";
import { getKeyBindingsManager } from "../../../KeyBindingsManager";
import { NotificationState } from "../../../stores/notifications/NotificationState";
import SpaceContextMenu from "../context_menus/SpaceContextMenu";
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
import { useRovingTabIndex } from "../../../accessibility/RovingTabIndex";
import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
interface IButtonProps extends Omit<ComponentProps<typeof AccessibleTooltipButton>, "title" | "onClick"> {
space?: Room;
@ -234,7 +235,7 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
const action = getKeyBindingsManager().getRoomListAction(ev);
const hasChildren = this.state.childSpaces?.length;
switch (action) {
case RoomListAction.CollapseSection:
case KeyBindingAction.CollapseRoomListSection:
if (hasChildren && !this.isCollapsed) {
this.toggleCollapse(ev);
} else {
@ -244,7 +245,7 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
}
break;
case RoomListAction.ExpandSection:
case KeyBindingAction.ExpandRoomListSection:
if (hasChildren) {
if (this.isCollapsed) {
this.toggleCollapse(ev);