Browse Source

fix: Form label hide title on help icon and optional text (#31785)

close #31769
pull/31787/head
afc163 3 years ago
committed by GitHub
parent
commit
f0163aa337
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      components/config-provider/__tests__/__snapshots__/form.test.js.snap
  2. 4
      components/form/FormItemLabel.tsx
  3. 5
      components/form/__tests__/__snapshots__/demo.test.js.snap

1
components/config-provider/__tests__/__snapshots__/form.test.js.snap

@ -18,6 +18,7 @@ exports[`ConfigProvider.Form form requiredMark set requiredMark optional 1`] = `
年龄
<span
class="ant-form-item-optional"
title=""
>
(optional)
</span>

4
components/form/FormItemLabel.tsx

@ -88,7 +88,7 @@ const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixC
const { icon = <QuestionCircleOutlined />, ...restTooltipProps } = tooltipProps;
const tooltipNode = (
<Tooltip {...restTooltipProps}>
{React.cloneElement(icon, { className: `${prefixCls}-item-tooltip` })}
{React.cloneElement(icon, { className: `${prefixCls}-item-tooltip`, title: '' })}
</Tooltip>
);
@ -105,7 +105,7 @@ const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixC
labelChildren = (
<>
{labelChildren}
<span className={`${prefixCls}-item-optional`}>
<span className={`${prefixCls}-item-optional`} title="">
{formLocale?.optional || defaultLocale.Form?.optional}
</span>
</>

5
components/form/__tests__/__snapshots__/demo.test.js.snap

@ -3244,6 +3244,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
aria-label="question-circle"
class="anticon anticon-question-circle ant-form-item-tooltip"
role="img"
title=""
>
<svg
aria-hidden="true"
@ -3763,6 +3764,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
Required Mark
<span
class="ant-form-item-optional"
title=""
>
(optional)
</span>
@ -3859,6 +3861,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
aria-label="question-circle"
class="anticon anticon-question-circle ant-form-item-tooltip"
role="img"
title=""
>
<svg
aria-hidden="true"
@ -3913,6 +3916,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
aria-label="info-circle"
class="anticon anticon-info-circle ant-form-item-tooltip"
role="img"
title=""
>
<svg
aria-hidden="true"
@ -3933,6 +3937,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
</span>
<span
class="ant-form-item-optional"
title=""
>
(optional)
</span>

Loading…
Cancel
Save