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

Commit 95ee297

Browse files
authored
Tooltip: improve accessibility of the right panel (#12490)
* Move to `AccessibleButton` * Update snapshots * Update playwright snapshots
1 parent 3059b5b commit 95ee297

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed
Loading

src/components/views/right_panel/HeaderButton.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ limitations under the License.
2121
import React, { ReactNode } from "react";
2222
import classNames from "classnames";
2323

24-
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
25-
import { ButtonEvent } from "../elements/AccessibleButton";
26-
import { Alignment } from "../elements/Tooltip";
24+
import AccessibleButton, { ButtonEvent } from "../elements/AccessibleButton";
2725

2826
interface IProps {
2927
// Whether this button is highlighted
@@ -52,11 +50,11 @@ export default class HeaderButton extends React.Component<IProps> {
5250
});
5351

5452
return (
55-
<AccessibleTooltipButton
53+
<AccessibleButton
5654
{...props}
5755
aria-current={isHighlighted ? "true" : "false"}
5856
title={title}
59-
alignment={Alignment.Bottom}
57+
placement="bottom"
6058
className={classes}
6159
onClick={onClick}
6260
/>

src/components/views/right_panel/RoomSummaryCard.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import WidgetUtils from "../../../utils/WidgetUtils";
4949
import { IntegrationManagers } from "../../../integrations/IntegrationManagers";
5050
import SettingsStore from "../../../settings/SettingsStore";
5151
import WidgetAvatar from "../avatars/WidgetAvatar";
52-
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
5352
import WidgetStore, { IApp } from "../../../stores/WidgetStore";
5453
import { E2EStatus } from "../../../utils/ShieldUtils";
5554
import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
@@ -184,18 +183,17 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
184183

185184
return (
186185
<div className={classes} ref={handle}>
187-
<AccessibleTooltipButton
186+
<AccessibleButton
188187
className="mx_RoomSummaryCard_icon_app"
189188
onClick={onOpenWidgetClick}
190189
// only show a tooltip if the widget is pinned
191-
title={openTitle}
192-
forceHide={!(isPinned || isMaximised)}
190+
title={!(isPinned || isMaximised) ? undefined : openTitle}
193191
disabled={isPinned || isMaximised}
194192
>
195193
<WidgetAvatar app={app} size="20px" />
196194
<span>{name}</span>
197195
{subtitle}
198-
</AccessibleTooltipButton>
196+
</AccessibleButton>
199197

200198
{canModifyWidget && (
201199
<ContextMenuTooltipButton
@@ -206,13 +204,13 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
206204
/>
207205
)}
208206

209-
<AccessibleTooltipButton
207+
<AccessibleButton
210208
className="mx_RoomSummaryCard_app_pinToggle"
211209
onClick={togglePin}
212210
title={pinTitle}
213211
disabled={cannotPin}
214212
/>
215-
<AccessibleTooltipButton
213+
<AccessibleButton
216214
className="mx_RoomSummaryCard_app_maximiseToggle"
217215
onClick={toggleMaximised}
218216
title={maximiseTitle}

test/components/views/right_panel/__snapshots__/LegacyRoomHeaderButtons-test.tsx.snap

+3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ exports[`LegacyRoomHeaderButtons-test.tsx should render 1`] = `
66
aria-current="false"
77
aria-label="Chat"
88
class="mx_AccessibleButton mx_LegacyRoomHeader_button mx_RightPanel_timelineCardButton"
9+
data-state="closed"
910
role="button"
1011
tabindex="0"
1112
/>
1213
<div
1314
aria-current="false"
1415
aria-label="Threads"
1516
class="mx_AccessibleButton mx_LegacyRoomHeader_button mx_RightPanel_threadsButton"
17+
data-state="closed"
1618
data-testid="threadsButton"
1719
role="button"
1820
tabindex="0"
@@ -21,6 +23,7 @@ exports[`LegacyRoomHeaderButtons-test.tsx should render 1`] = `
2123
aria-current="false"
2224
aria-label="Room info"
2325
class="mx_AccessibleButton mx_LegacyRoomHeader_button mx_RightPanel_roomSummaryButton"
26+
data-state="closed"
2427
role="button"
2528
tabindex="0"
2629
/>

0 commit comments

Comments
 (0)