Skip to content
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

Merged
merged 1 commit into from
Mar 2, 2016
Merged

[CardTitle] remove title from injected node attributes (to avoid native tooltip) #3535

merged 1 commit into from
Mar 2, 2016

Conversation

antoinerousseau
Copy link
Contributor

  • PR has tests / docs demo
  • PR is linted
  • Commit and PR titles begin with [ComponentName], and are in imperative form: "[Component] Fix leaky abstraction"
  • Description explains the issue / use-case resolved, and auto-closes the related issue

Fixes #2894.

return (
<div {...this.props} style={prepareStyles(rootStyle)}>
<div {...attrs} style={prepareStyles(rootStyle)}>
<span style={prepareStyles(titleStyle)}>
{this.props.title}
</span>
Copy link
Member

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>

Copy link
Contributor Author

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 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -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;
Copy link
Member

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;

@newoga
Copy link
Contributor

newoga commented Mar 2, 2016

Looks good, thanks @antoinerousseau!

newoga added a commit that referenced this pull request Mar 2, 2016
[CardTitle] remove `title` from injected node attributes (to avoid native tooltip)
@newoga newoga merged commit d11bd30 into mui:master Mar 2, 2016
@antoinerousseau antoinerousseau deleted the cardtitle-title branch March 2, 2016 04:24
mbradleyis pushed a commit to staticinstance/material-ui that referenced this pull request Mar 7, 2016
[CardTitle] remove `title` from injected node attributes (to avoid native tooltip)
@zannager zannager added the component: card This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: card This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CardTitle title prop conflicts with native browser behaviour
5 participants