Skip to content

Commit

Permalink
Merge pull request #842 from vrk-kpa/fix/remove-props-from-dom
Browse files Browse the repository at this point in the history
[Fix] Remove unwanted props from DOM + remove redundant never types from some conditional props
  • Loading branch information
riitasointi authored Mar 22, 2024
2 parents 2816e25 + 60fb814 commit e9decf7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type ForcedAccessibleNameProps =

export type LoadingProps =
| {
loading?: false | never;
loading?: false;
ariaLoadingText?: never;
}
| {
Expand Down
4 changes: 2 additions & 2 deletions src/core/Form/Select/MultiSelect/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type AriaSelectedAmountProps =

type LoadingProps =
| {
loading?: false | never;
loading?: false;
loadingText?: string;
}
| {
Expand Down Expand Up @@ -198,7 +198,7 @@ interface InternalMultiSelectProps<T extends MultiSelectData> {

type AllowItemAdditionProps =
| {
allowItemAddition?: false | never;
allowItemAddition?: false;
itemAdditionHelpText?: never;
noItemsText: string;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Form/Select/SingleSelect/SingleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export interface InternalSingleSelectProps<T extends SingleSelectData> {

type LoadingProps =
| {
loading?: false | never;
loading?: false;
loadingText?: string;
}
| {
Expand All @@ -146,7 +146,7 @@ type LoadingProps =

type AllowItemAdditionProps =
| {
allowItemAddition?: false | never;
allowItemAddition?: false;
itemAdditionHelpText?: never;
noItemsText: string;
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class BaseTooltip extends Component<TooltipProps & { className?: string }> {
forwardedRef,
anchorElement,
className,
onToggleButtonClick,
onCloseButtonClick,
...passProps
} = this.props;
const open = 'open' in this.props ? propsOpen : this.state.open;
Expand Down
7 changes: 4 additions & 3 deletions src/core/VisuallyHidden/VisuallyHidden.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export interface VisuallyHiddenProps extends HtmlSpanProps {

const baseClassName = 'fi-visually-hidden';

const StyledVisuallyHidden = styled((props: VisuallyHiddenProps) => (
<HtmlSpan {...props} />
))`
const StyledVisuallyHidden = styled((props: VisuallyHiddenProps) => {
const { forwardedRef, ...passProps } = props;
return <HtmlSpan forwardedRef={forwardedRef} {...passProps} />;
})`
position: absolute;
clip: rect(0 0 0 0);
height: 1px;
Expand Down

0 comments on commit e9decf7

Please sign in to comment.