Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Remove message navigation code
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Mar 8, 2024
1 parent 8c7936d commit b97af9d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
16 changes: 0 additions & 16 deletions src/accessibility/KeyboardShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ export const CATEGORIES: Record<CategoryName, ICategory> = {
KeyBindingAction.SelectPrevUnreadRoom,
KeyBindingAction.SelectNextRoom,
KeyBindingAction.SelectPrevRoom,
KeyBindingAction.SelectNextMessage,
KeyBindingAction.SelectPrevMessage,
KeyBindingAction.OpenUserSettings,
KeyBindingAction.SwitchToSpaceByNumber,
KeyBindingAction.PreviousVisitedRoomOrSpace,
Expand Down Expand Up @@ -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,
Expand Down
39 changes: 0 additions & 39 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -207,7 +205,6 @@ interface IReadReceiptForUser {
*/
export default class MessagePanel extends React.Component<IProps, IState> {
public static contextType = RoomContext;
public focusedEventId?: string;
public context!: React.ContextType<typeof RoomContext>;

public static defaultProps = {
Expand Down Expand Up @@ -425,42 +422,6 @@ export default class MessagePanel extends React.Component<IProps, IState> {
* @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<HTMLElement>('.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);
}

Expand Down

0 comments on commit b97af9d

Please sign in to comment.