Files
healthchat-web/apps/web/src/accessibility/context_menu/ContextMenuTooltipButton.tsx
T
Michael Telatynski b6859885a3 Upgrade to TypeScript 7 (#34208)
* Upgrade to TypeScript 7

for massive tsc speed gains

Those on WebStorm will want to upgrade to EAP to reap the benefits of the new TSGo compiler

Some things (module-api & shared-components) which utilise unplugin-dts (and api-extractor) need to hold a copy of ts6 for its conventional lib format and API. TS7 ships with no API until TS7.1.

Other things which use eslint also need ts6 for typescript-eslint.

Some type changes were necessary as TS7 caught some issues.

* Add knip exception

* Fix bad merge
2026-07-14 08:09:03 +00:00

44 lines
1.2 KiB
TypeScript

/*
Copyright 2024 New Vector Ltd.
Copyright 2019 The Matrix.org Foundation C.I.C.
Copyright 2018 New Vector Ltd
Copyright 2015, 2016 OpenMarket Ltd
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import React, { type JSX, type Ref } from "react";
import AccessibleButton, { type ButtonProps } from "../../components/views/elements/AccessibleButton";
type Props = Omit<ButtonProps<"div">, "element" | "ref"> & {
// whether the context menu is currently open
isExpanded: boolean;
ref?: Ref<HTMLElement>;
};
// Semantic component for representing the AccessibleButton which launches a <ContextMenu />
export const ContextMenuTooltipButton = function ({
isExpanded,
children,
onClick,
onContextMenu,
ref,
...props
}: Props): JSX.Element {
return (
<AccessibleButton
{...props}
onClick={onClick}
onContextMenu={onContextMenu ?? onClick ?? undefined}
aria-haspopup={true}
aria-expanded={isExpanded}
disableTooltip={isExpanded}
ref={ref}
>
{children}
</AccessibleButton>
);
};