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

Commit 9aeaa38

Browse files
authored
Tooltip: Use AccessibleButton in dialogs (#12460)
* Update dialogs * Use default right placement
1 parent 44e2a6d commit 9aeaa38

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/components/views/dialogs/ForwardDialog.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ import { avatarUrlForUser } from "../../../Avatar";
4141
import EventTile from "../rooms/EventTile";
4242
import SearchBox from "../../structures/SearchBox";
4343
import DecoratedRoomAvatar from "../avatars/DecoratedRoomAvatar";
44-
import { Alignment } from "../elements/Tooltip";
45-
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
4644
import AutoHideScrollbar from "../../structures/AutoHideScrollbar";
4745
import { StaticNotificationState } from "../../../stores/notifications/StaticNotificationState";
4846
import NotificationBadge from "../rooms/NotificationBadge";
@@ -54,7 +52,7 @@ import EntityTile from "../rooms/EntityTile";
5452
import BaseAvatar from "../avatars/BaseAvatar";
5553
import { Action } from "../../../dispatcher/actions";
5654
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
57-
import { ButtonEvent } from "../elements/AccessibleButton";
55+
import AccessibleButton, { ButtonEvent } from "../elements/AccessibleButton";
5856
import { isLocationEvent } from "../../../utils/EventUtils";
5957
import { isSelfLocation, locationEventGeoUri } from "../../../utils/location";
6058
import { RoomContextDetails } from "../rooms/RoomContextDetails";
@@ -159,32 +157,32 @@ const Entry: React.FC<IEntryProps<any>> = ({ room, type, content, matrixClient:
159157
onFocus={onFocus}
160158
id={id}
161159
>
162-
<AccessibleTooltipButton
160+
<AccessibleButton
163161
className="mx_ForwardList_roomButton"
164162
onClick={jumpToRoom}
165163
title={_t("forward|open_room")}
166-
alignment={Alignment.Top}
164+
placement="top"
167165
tabIndex={isActive ? 0 : -1}
168166
>
169167
<DecoratedRoomAvatar room={room} size="32px" tooltipProps={{ tabIndex: isActive ? 0 : -1 }} />
170168
<span className="mx_ForwardList_entry_name" id={`${id}_name`}>
171169
{room.name}
172170
</span>
173171
<RoomContextDetails component="span" className="mx_ForwardList_entry_detail" room={room} />
174-
</AccessibleTooltipButton>
175-
<AccessibleTooltipButton
172+
</AccessibleButton>
173+
<AccessibleButton
176174
kind={sendState === SendState.Failed ? "danger_outline" : "primary_outline"}
177175
className={`mx_ForwardList_sendButton ${className}`}
178176
onClick={send}
179177
disabled={disabled}
180178
title={title}
181-
alignment={Alignment.Top}
179+
placement="top"
182180
tabIndex={isActive ? 0 : -1}
183181
id={`${id}_send`}
184182
>
185183
<div className="mx_ForwardList_sendLabel">{_t("forward|send_label")}</div>
186184
{icon}
187-
</AccessibleTooltipButton>
185+
</AccessibleButton>
188186
</div>
189187
);
190188
};

src/components/views/dialogs/spotlight/SpotlightDialog.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,9 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
939939
setInviteLinkCopied(true);
940940
copyPlaintext(ownInviteLink);
941941
}}
942-
onHideTooltip={() => setInviteLinkCopied(false)}
942+
onTooltipOpenChange={(open) => {
943+
if (!open) setInviteLinkCopied(false);
944+
}}
943945
title={inviteLinkCopied ? _t("common|copied") : _t("action|copy")}
944946
>
945947
<span className="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline">

src/components/views/dialogs/spotlight/TooltipOption.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ limitations under the License.
1717
import classNames from "classnames";
1818
import React, { ComponentProps, ReactNode } from "react";
1919

20-
import { RovingAccessibleTooltipButton } from "../../../../accessibility/roving/RovingAccessibleTooltipButton";
2120
import { useRovingTabIndex } from "../../../../accessibility/RovingTabIndex";
22-
import AccessibleTooltipButton from "../../elements/AccessibleTooltipButton";
21+
import AccessibleButton from "../../elements/AccessibleButton";
22+
import { Ref } from "../../../../accessibility/roving/types";
2323

24-
interface TooltipOptionProps extends ComponentProps<typeof RovingAccessibleTooltipButton> {
24+
interface TooltipOptionProps extends ComponentProps<typeof AccessibleButton> {
2525
endAdornment?: ReactNode;
26+
inputRef?: Ref;
2627
}
2728

2829
export const TooltipOption: React.FC<TooltipOptionProps> = ({ inputRef, className, ...props }) => {
2930
const [onFocus, isActive, ref] = useRovingTabIndex(inputRef);
3031
return (
31-
<AccessibleTooltipButton
32+
<AccessibleButton
3233
{...props}
3334
className={classNames(className, "mx_SpotlightDialog_option")}
3435
onFocus={onFocus}

0 commit comments

Comments
 (0)