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

Commit 45132ec

Browse files
authored
MenuItem: fix caption usage (#12455)
* Add placement and fix additional span for `AccessibleButton` * Use only `RovingAccessibleButton` in `MenuItem` * Replace `tooltip` by `caption` * Update snapshots
1 parent 264e202 commit 45132ec

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

src/accessibility/context_menu/MenuItem.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,16 @@ limitations under the License.
1818

1919
import React from "react";
2020

21-
import { RovingAccessibleButton, RovingAccessibleTooltipButton } from "../RovingTabIndex";
21+
import { RovingAccessibleButton } from "../RovingTabIndex";
2222

2323
interface IProps extends React.ComponentProps<typeof RovingAccessibleButton> {
2424
label?: string;
25-
tooltip?: string;
2625
}
2726

2827
// Semantic component for representing a role=menuitem
29-
export const MenuItem: React.FC<IProps> = ({ children, label, tooltip, ...props }) => {
28+
export const MenuItem: React.FC<IProps> = ({ children, label, ...props }) => {
3029
const ariaLabel = props["aria-label"] || label;
3130

32-
if (tooltip) {
33-
return (
34-
<RovingAccessibleTooltipButton {...props} role="menuitem" aria-label={ariaLabel} title={tooltip}>
35-
{children}
36-
</RovingAccessibleTooltipButton>
37-
);
38-
}
39-
4031
return (
4132
<RovingAccessibleButton {...props} role="menuitem" aria-label={ariaLabel}>
4233
{children}

src/components/views/rooms/RoomList.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const DmAuxButton: React.FC<IAuxButtonProps> = ({ tabIndex, dispatcher = default
160160
showSpaceInvite(activeSpace);
161161
}}
162162
disabled={!canInvite}
163-
tooltip={canInvite ? undefined : _t("spaces|error_no_permission_invite")}
163+
title={canInvite ? undefined : _t("spaces|error_no_permission_invite")}
164164
/>
165165
)}
166166
</IconizedContextMenuOptionList>
@@ -250,7 +250,7 @@ const UntaggedAuxButton: React.FC<IAuxButtonProps> = ({ tabIndex }) => {
250250
PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuCreateRoomItem", e);
251251
}}
252252
disabled={!canAddRooms}
253-
tooltip={canAddRooms ? undefined : _t("spaces|error_no_permission_create_room")}
253+
title={canAddRooms ? undefined : _t("spaces|error_no_permission_create_room")}
254254
/>
255255
{videoRoomsEnabled && (
256256
<IconizedContextMenuOption
@@ -266,7 +266,7 @@ const UntaggedAuxButton: React.FC<IAuxButtonProps> = ({ tabIndex }) => {
266266
);
267267
}}
268268
disabled={!canAddRooms}
269-
tooltip={canAddRooms ? undefined : _t("spaces|error_no_permission_create_room")}
269+
title={canAddRooms ? undefined : _t("spaces|error_no_permission_create_room")}
270270
>
271271
<BetaPill />
272272
</IconizedContextMenuOption>
@@ -281,7 +281,7 @@ const UntaggedAuxButton: React.FC<IAuxButtonProps> = ({ tabIndex }) => {
281281
showAddExistingRooms(activeSpace);
282282
}}
283283
disabled={!canAddRooms}
284-
tooltip={canAddRooms ? undefined : _t("spaces|error_no_permission_add_room")}
284+
title={canAddRooms ? undefined : _t("spaces|error_no_permission_add_room")}
285285
/>
286286
</>
287287
) : null}

src/components/views/rooms/RoomListHeader.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ const RoomListHeader: React.FC<IProps> = ({ onVisibilityChange }) => {
267267
closePlusMenu();
268268
}}
269269
disabled={!canAddSubRooms}
270-
tooltip={!canAddSubRooms ? _t("spaces|error_no_permission_add_room") : undefined}
270+
title={!canAddSubRooms ? _t("spaces|error_no_permission_add_room") : undefined}
271271
/>
272272
{canCreateSpaces && (
273273
<IconizedContextMenuOption
@@ -280,7 +280,7 @@ const RoomListHeader: React.FC<IProps> = ({ onVisibilityChange }) => {
280280
closePlusMenu();
281281
}}
282282
disabled={!canAddSubSpaces}
283-
tooltip={!canAddSubSpaces ? _t("spaces|error_no_permission_add_space") : undefined}
283+
title={!canAddSubSpaces ? _t("spaces|error_no_permission_add_space") : undefined}
284284
>
285285
<BetaPill />
286286
</IconizedContextMenuOption>

0 commit comments

Comments
 (0)