Skip to content

Commit d0a8879

Browse files
authored
Revert "A11y: move focus to right panel when opened" (#30999)
* Revert "A11y: move focus to right panel when opened (#30553)" This reverts commit 0c498a6. * test(e2e): update test
1 parent e6e6f87 commit d0a8879

6 files changed

Lines changed: 3 additions & 24 deletions

File tree

playwright/pages/ElementAppPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export class ElementAppPage {
218218
*/
219219
public async inviteUserToCurrentRoom(userId: string): Promise<void> {
220220
await this.toggleRoomInfoPanel(); // TODO skip this if the room info panel is already open
221-
await this.page.getByLabel("Right panel").getByRole("menuitem", { name: "Invite" }).click();
221+
await this.page.getByTestId("right-panel").getByRole("menuitem", { name: "Invite" }).click();
222222

223223
const input = this.page.getByRole("dialog").getByTestId("invite-dialog-input");
224224
await input.fill(userId);
658 Bytes
Loading

src/components/structures/RightPanel.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import { Action } from "../../dispatcher/actions";
3434
import { type XOR } from "../../@types/common";
3535
import ExtensionsCard from "../views/right_panel/ExtensionsCard";
3636
import MemberListView from "../views/rooms/MemberList/MemberListView";
37-
import { _t } from "../../languageHandler";
3837

3938
interface BaseProps {
4039
overwriteCard?: IRightPanelCard; // used to display a custom card and ignoring the RightPanelStore (used for UserView)
@@ -65,7 +64,6 @@ interface IState {
6564
export default class RightPanel extends React.Component<Props, IState> {
6665
public static contextType = MatrixClientContext;
6766
declare public context: React.ContextType<typeof MatrixClientContext>;
68-
private ref = React.createRef<HTMLDivElement>();
6967

7068
public constructor(props: Props) {
7169
super(props);
@@ -84,7 +82,6 @@ export default class RightPanel extends React.Component<Props, IState> {
8482
public componentDidMount(): void {
8583
this.context.on(RoomStateEvent.Members, this.onRoomStateMember);
8684
RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate);
87-
this.ref.current?.focus();
8885
}
8986

9087
public componentWillUnmount(): void {
@@ -122,13 +119,7 @@ export default class RightPanel extends React.Component<Props, IState> {
122119
};
123120

124121
private onRightPanelStoreUpdate = (): void => {
125-
const oldPhase = this.state.phase;
126-
const newState = RightPanel.getDerivedStateFromProps(this.props) as IState;
127-
this.setState({ ...newState });
128-
129-
if (oldPhase !== newState.phase) {
130-
this.ref.current?.focus();
131-
}
122+
this.setState({ ...(RightPanel.getDerivedStateFromProps(this.props) as IState) });
132123
};
133124

134125
private onClose = (): void => {
@@ -289,14 +280,7 @@ export default class RightPanel extends React.Component<Props, IState> {
289280
}
290281

291282
return (
292-
<aside
293-
aria-label={_t("right_panel|title")}
294-
ref={this.ref}
295-
className="mx_RightPanel"
296-
id="mx_RightPanel"
297-
data-testid="right-panel"
298-
tabIndex={-1}
299-
>
283+
<aside className="mx_RightPanel" id="mx_RightPanel" data-testid="right-panel">
300284
{card}
301285
</aside>
302286
);

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,6 @@
19171917
"thread_list": {
19181918
"context_menu_label": "Thread options"
19191919
},
1920-
"title": "Right panel",
19211920
"video_room_chat": {
19221921
"title": "Chat"
19231922
}

test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,11 +1958,9 @@ exports[`RoomView video rooms should render joined video room view 1`] = `
19581958
style="position: relative; user-select: auto; width: 420px; height: 100%; max-width: 50%; min-width: 320px; box-sizing: border-box; flex-shrink: 0;"
19591959
>
19601960
<aside
1961-
aria-label="Right panel"
19621961
class="mx_RightPanel"
19631962
data-testid="right-panel"
19641963
id="mx_RightPanel"
1965-
tabindex="-1"
19661964
>
19671965
<div
19681966
class="mx_BaseCard mx_ThreadPanel mx_TimelineCard"

test/unit-tests/components/views/elements/__snapshots__/AppTile-test.tsx.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
exports[`AppTile destroys non-persisted right panel widget on room change 1`] = `
44
<DocumentFragment>
55
<aside
6-
aria-label="Right panel"
76
class="mx_RightPanel"
87
data-testid="right-panel"
98
id="mx_RightPanel"
10-
tabindex="-1"
119
>
1210
<div
1311
class="mx_BaseCard mx_WidgetCard"

0 commit comments

Comments
 (0)