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

Commit

Permalink
fix room list landmark
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Mar 8, 2024
1 parent 8e7266f commit 4c644d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/structures/LeftPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ export default class LeftPanel extends React.Component<IProps, IState> {
case KeyBindingAction.NextLandmark:
ev.stopPropagation();
ev.preventDefault();
// The next landmark is the selected room or the room list header, if none selected.
document.querySelector<HTMLElement>(".mx_RoomTile_selected, .mx_RoomListHeader_contextMenuButton")?.focus();
// The next landmark is the selected room or the room first room, if none selected.
(document.querySelector<HTMLElement>(".mx_RoomTile_selected") || document.querySelector<HTMLElement>(".mx_RoomTile"))?.focus();
break;
case KeyBindingAction.PreviousLandmark:
ev.stopPropagation();
Expand Down
2 changes: 2 additions & 0 deletions src/components/views/rooms/RoomList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
onKeyDown={(ev) => {
const navAction = getKeyBindingsManager().getNavigationAction(ev);
if (navAction === KeyBindingAction.NextLandmark) {
// The next landmark is the message composer or the thread message composer.
const inThread = !!document.activeElement?.closest(".mx_ThreadView");
defaultDispatcher.dispatch(
{
Expand All @@ -665,6 +666,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
}

if (navAction === KeyBindingAction.PreviousLandmark) {
// The previous landmark is the room search input.
document.querySelector(".mx_RoomSearch")?.focus();
ev.stopPropagation();
ev.preventDefault();
Expand Down
1 change: 0 additions & 1 deletion src/components/views/rooms/SendMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
return;
}
const replyingToThread = this.props.relation?.key === THREAD_RELATION_TYPE.name;

const action = getKeyBindingsManager().getMessageComposerAction(event);
switch (action) {
case KeyBindingAction.SendMessage:
Expand Down
2 changes: 2 additions & 0 deletions src/components/views/spaces/SpacePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ const SpacePanel: React.FC = () => {
onKeyDown={(ev) => {
const navAction = getKeyBindingsManager().getNavigationAction(ev);
if (navAction === KeyBindingAction.PreviousLandmark) {
// The previous landmark is the message composer or the thread message composer.
const inThread = !!document.activeElement?.closest(".mx_ThreadView");
defaultDispatcher.dispatch(
{
Expand All @@ -387,6 +388,7 @@ const SpacePanel: React.FC = () => {
return;
}
if (navAction === KeyBindingAction.NextLandmark) {
// The next landmark is the room search input.
document.querySelector(".mx_RoomSearch")?.focus();
ev.stopPropagation();
ev.preventDefault();
Expand Down

0 comments on commit 4c644d8

Please sign in to comment.