diff --git a/src/accessibility/KeyboardShortcuts.ts b/src/accessibility/KeyboardShortcuts.ts index 92e24ef6785..89ae50d79d8 100644 --- a/src/accessibility/KeyboardShortcuts.ts +++ b/src/accessibility/KeyboardShortcuts.ts @@ -290,8 +290,6 @@ export const CATEGORIES: Record = { KeyBindingAction.SelectPrevUnreadRoom, KeyBindingAction.SelectNextRoom, KeyBindingAction.SelectPrevRoom, - KeyBindingAction.SelectNextMessage, - KeyBindingAction.SelectPrevMessage, KeyBindingAction.OpenUserSettings, KeyBindingAction.SwitchToSpaceByNumber, KeyBindingAction.PreviousVisitedRoomOrSpace, @@ -566,20 +564,6 @@ export const KEYBOARD_SHORTCUTS: IKeyboardShortcuts = { }, displayName: _td("keyboard|prev_room"), }, - [KeyBindingAction.SelectNextMessage]: { - default: { - ctrlOrCmdKey: true, - key: Key.ARROW_DOWN, - }, - displayName: _td("keyboard|next_message"), - }, - [KeyBindingAction.SelectPrevMessage]: { - default: { - ctrlOrCmdKey: true, - key: Key.ARROW_UP, - }, - displayName: _td("keyboard|prev_message"), - }, [KeyBindingAction.CancelAutocomplete]: { default: { key: Key.ESCAPE, diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index e77c35ad228..3a97f27b381 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -56,8 +56,6 @@ import { MainGrouper } from "./grouper/MainGrouper"; import { CreationGrouper } from "./grouper/CreationGrouper"; import { _t } from "../../languageHandler"; import { getLateEventInfo } from "./grouper/LateEventGrouper"; -import { getKeyBindingsManager } from "../../KeyBindingsManager"; -import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts"; const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes const continuedTypes = [EventType.Sticker, EventType.RoomMessage]; @@ -207,7 +205,6 @@ interface IReadReceiptForUser { */ export default class MessagePanel extends React.Component { public static contextType = RoomContext; - public focusedEventId?: string; public context!: React.ContextType; public static defaultProps = { @@ -425,42 +422,6 @@ export default class MessagePanel extends React.Component { * @param {KeyboardEvent} ev: the keyboard event to handle */ public handleScrollKey(ev: React.KeyboardEvent | KeyboardEvent): void { - const navAction = getKeyBindingsManager().getNavigationAction(ev); - if (navAction === KeyBindingAction.SelectPrevMessage || navAction === KeyBindingAction.SelectNextMessage) { - const events: WrappedEvent[] = this.props.events.map((event) => { - return { event, shouldShow: this.shouldShowEvent(event) }; - }); - const currentEventId = - this.focusedEventId || - this.props.highlightedEventId || - (events[events.length - 1] ? events[events.length - 1].event.getId() : null); - if (navAction === KeyBindingAction.SelectPrevMessage) { - events.reverse(); - } - let previousEventId = null; - for (let i = events.length - 1; i >= 0; i--) { - const eventId = events[i].event.getId()!; - if (previousEventId && eventId === currentEventId) { - document.querySelector('.mx_EventTile[data-event-id="' + previousEventId + '"]')?.focus(); - this.focusedEventId = previousEventId; - ev.preventDefault(); - return; - } - if (document.querySelector('.mx_EventTile[data-event-id="' + eventId + '"]')) { - previousEventId = eventId; - } - } - if (navAction === KeyBindingAction.SelectNextMessage) { - defaultDispatcher.dispatch( - { - action: Action.FocusSendMessageComposer, - context: TimelineRenderingType.Room, - }, - true, - ); - } - } - this.scrollPanel.current?.handleScrollKey(ev); }