From fae6f509d93fe2d7871194134983056dd1ed7774 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Fri, 26 Apr 2024 10:34:42 +0200 Subject: [PATCH] Add extra attribute to `AccessibleButton` --- .../views/elements/AccessibleButton.tsx | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/AccessibleButton.tsx b/src/components/views/elements/AccessibleButton.tsx index 26b4390e56b..05b844284a5 100644 --- a/src/components/views/elements/AccessibleButton.tsx +++ b/src/components/views/elements/AccessibleButton.tsx @@ -14,7 +14,7 @@ limitations under the License. */ -import React, { forwardRef, FunctionComponent, HTMLAttributes, InputHTMLAttributes, Ref } from "react"; +import React, { ComponentProps, forwardRef, FunctionComponent, HTMLAttributes, InputHTMLAttributes, Ref } from "react"; import classnames from "classnames"; import { Tooltip } from "@vector-im/compound-web"; @@ -61,6 +61,8 @@ type DynamicElementProps = Partial< > & Omit, "onClick">; +type TooltipProps = ComponentProps; + /** * Type of props accepted by {@link AccessibleButton}. * @@ -96,6 +98,14 @@ type Props = DynamicHtmlElementProps & * Only valid when used in conjunction with `title`. */ caption?: string; + /** + * The placement of the tooltip. + */ + placement?: TooltipProps["placement"]; + /** + * Callback for when the tooltip is opened or closed. + */ + onTooltipOpenChange?: TooltipProps["onOpenChange"]; }; /** @@ -128,6 +138,8 @@ const AccessibleButton = forwardRef(function , ref: Ref, @@ -199,7 +211,13 @@ const AccessibleButton = forwardRef(function + {button} );