fix: 🐛 Typography title prop support (#24440)

This commit is contained in:
Kermit Xuan 2020-05-25 19:04:40 +08:00 committed by GitHub
parent f0a4e211b1
commit 84bd53627b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -407,7 +407,6 @@ class Base extends React.Component<InternalBlockProps & ConfigConsumerProps, Bas
type,
disabled,
style,
title,
...restProps
} = this.props;
const { rows, suffix } = this.getEllipsis();
@ -435,6 +434,7 @@ class Base extends React.Component<InternalBlockProps & ConfigConsumerProps, Bas
// Only use js ellipsis when css ellipsis not support
if (rows && isEllipsis && !expanded && !cssEllipsis) {
const { title } = restProps;
ariaLabel = title;
if (!title && (typeof children === 'string' || typeof children === 'number')) {
ariaLabel = String(children);

View File

@ -634,6 +634,7 @@ exports[`renders ./components/typography/demo/suffix.md correctly 1`] = `
</div>
<div
class="ant-typography ant-typography-ellipsis"
title="To be, or not to be, that is a question: Whether it is nobler in the mind to suffer. The slings and arrows of outrageous fortune Or to take arms against a sea of troubles, And by opposing end them? To die: to sleep; No more; and by a sleep to say we end The heart-ache and the thousand natural shocks That flesh is heir to, 'tis a consummation Devoutly to be wish'd. To die, to sleep To sleep- perchance to dream: ay, there's the rub! For in that sleep of death what dreams may come When we have shuffled off this mortal coil, Must give us pause. There 's the respect That makes calamity of so long life--William Shakespeare"
>
To be, or not to be, that is a question: Whether it is nobler in the mind to suffer. The slings and arrows of outrageous fortune Or to take arms against a sea of troubles, And by opposing end them? To die: to sleep; No more; and by a sleep to say we end The heart-ache and the thousand natural shocks That flesh is heir to, 'tis a consummation Devoutly to be wish'd. To die, to sleep To sleep- perchance to dream: ay, there's the rub! For in that sleep of death what dreams may come When we have shuffled off this mortal coil, Must give us pause. There 's the respect That makes calamity of so long life--William Shakespeare
</div>