-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CardTitle] remove title
from injected node attributes (to avoid native tooltip)
#3535
Conversation
return ( | ||
<div {...this.props} style={prepareStyles(rootStyle)}> | ||
<div {...attrs} style={prepareStyles(rootStyle)}> | ||
<span style={prepareStyles(titleStyle)}> | ||
{this.props.title} | ||
</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work?
const {title, ...other} = this.props;
return (
<div {...other} style={prepareStyles(rootStyle)}>
<span style={prepareStyles(titleStyle)}>
{title}
</span>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicer indeed! didn't know I could already use this ES7 bit :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSX has implemented it: https://facebook.github.io/react/docs/transferring-props.html#transferring-with-...-in-jsx
@@ -79,13 +79,15 @@ const CardTitle = React.createClass({ | |||
const titleStyle = Object.assign({}, styles.title, this.props.titleStyle); | |||
const subtitleStyle = Object.assign({}, styles.subtitle, this.props.subtitleStyle); | |||
|
|||
const {title, subtitle, ...attrs} = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we follow the other components?
const {
title,
subtitle,
...other,
} = this.props;
Looks good, thanks @antoinerousseau! |
[CardTitle] remove `title` from injected node attributes (to avoid native tooltip)
[CardTitle] remove `title` from injected node attributes (to avoid native tooltip)
Fixes #2894.