From 5b226bb818b91dc8de846d30b476c6f77fbcbac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20P=C3=A4ttikangas?= Date: Fri, 22 Mar 2024 13:20:32 +0200 Subject: [PATCH 1/3] Remove some unwanted props from leaking to DOM --- src/core/Tooltip/Tooltip.tsx | 2 ++ src/core/VisuallyHidden/VisuallyHidden.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/Tooltip/Tooltip.tsx b/src/core/Tooltip/Tooltip.tsx index cae4bef26..7d4efbcae 100644 --- a/src/core/Tooltip/Tooltip.tsx +++ b/src/core/Tooltip/Tooltip.tsx @@ -154,6 +154,8 @@ class BaseTooltip extends Component { forwardedRef, anchorElement, className, + onToggleButtonClick, + onCloseButtonClick, ...passProps } = this.props; const open = 'open' in this.props ? propsOpen : this.state.open; diff --git a/src/core/VisuallyHidden/VisuallyHidden.tsx b/src/core/VisuallyHidden/VisuallyHidden.tsx index 22049c313..48bc4e683 100644 --- a/src/core/VisuallyHidden/VisuallyHidden.tsx +++ b/src/core/VisuallyHidden/VisuallyHidden.tsx @@ -12,9 +12,10 @@ export interface VisuallyHiddenProps extends HtmlSpanProps { const baseClassName = 'fi-visually-hidden'; -const StyledVisuallyHidden = styled((props: VisuallyHiddenProps) => ( - -))` +const StyledVisuallyHidden = styled((props: VisuallyHiddenProps) => { + const { forwardedRef, ...passProps } = props; + return ; +})` position: absolute; clip: rect(0 0 0 0); height: 1px; From ca1d63df8017274f0113ca7de80ea3aeaf1a908c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20P=C3=A4ttikangas?= Date: Fri, 22 Mar 2024 13:22:43 +0200 Subject: [PATCH 2/3] Remove redundant "never" typings from some conditional props --- src/core/Button/Button.tsx | 2 +- src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx | 2 +- src/core/Form/Select/SingleSelect/SingleSelect.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/Button/Button.tsx b/src/core/Button/Button.tsx index 40e1429fb..936ec5c13 100644 --- a/src/core/Button/Button.tsx +++ b/src/core/Button/Button.tsx @@ -39,7 +39,7 @@ export type ForcedAccessibleNameProps = export type LoadingProps = | { - loading?: false | never; + loading?: false; ariaLoadingText?: never; } | { diff --git a/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx b/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx index 813e2aa32..7ba7a76f5 100644 --- a/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx +++ b/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx @@ -106,7 +106,7 @@ type AriaSelectedAmountProps = type LoadingProps = | { - loading?: false | never; + loading?: false; loadingText?: string; } | { diff --git a/src/core/Form/Select/SingleSelect/SingleSelect.tsx b/src/core/Form/Select/SingleSelect/SingleSelect.tsx index e63d9db77..5909b882b 100644 --- a/src/core/Form/Select/SingleSelect/SingleSelect.tsx +++ b/src/core/Form/Select/SingleSelect/SingleSelect.tsx @@ -132,7 +132,7 @@ export interface InternalSingleSelectProps { type LoadingProps = | { - loading?: false | never; + loading?: false; loadingText?: string; } | { @@ -146,7 +146,7 @@ type LoadingProps = type AllowItemAdditionProps = | { - allowItemAddition?: false | never; + allowItemAddition?: false; itemAdditionHelpText?: never; noItemsText: string; } From 60fb8146ff5bf0be0d514bc3cd40f110f0ebfe43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20P=C3=A4ttikangas?= Date: Fri, 22 Mar 2024 13:29:28 +0200 Subject: [PATCH 3/3] Remove redundant never type from AllowItemAdditionProps in MultiSelect --- src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx b/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx index 7ba7a76f5..1f08097f9 100644 --- a/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx +++ b/src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx @@ -198,7 +198,7 @@ interface InternalMultiSelectProps { type AllowItemAdditionProps = | { - allowItemAddition?: false | never; + allowItemAddition?: false; itemAdditionHelpText?: never; noItemsText: string; }