Skip to content

Commit

Permalink
fix(button): add missing html form attribute (#3664)
Browse files Browse the repository at this point in the history
fix(button): add missing formId attribute
  • Loading branch information
js2me authored May 24, 2024
1 parent 77ca591 commit 4d8f2ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './Button.css';

import { IconComponent, IconPropSize } from '@consta/icons/Icon';
import React, { useRef } from 'react';
import React, { HTMLProps, useRef } from 'react';

import { useForkRef } from '../../hooks/useForkRef/useForkRef';
import { cnMixFocus } from '../../mixs/MixFocus/MixFocus';
Expand Down Expand Up @@ -92,6 +92,7 @@ export type Props = {
title?: string;
children?: never;
type?: 'button' | 'reset' | 'submit';
formId?: HTMLProps<HTMLButtonElement>['form'];
};

export const COMPONENT_NAME = 'Button' as const;
Expand Down Expand Up @@ -131,6 +132,7 @@ export const Button = forwardRefWithAs<Props, 'button'>((props, ref) => {
as = 'button',
onlyIcon,
iconSize: iconSizeProp,
formId,
...otherProps
} = usePropsHandler(COMPONENT_NAME, props, buttonRef);

Expand All @@ -154,6 +156,7 @@ export const Button = forwardRefWithAs<Props, 'button'>((props, ref) => {
<Tag
{...otherProps}
onClick={onClick ? handleClick : undefined}
form={formId}
type={type}
className={cnButton(
{
Expand Down

0 comments on commit 4d8f2ee

Please sign in to comment.