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

Add type attribute to tag remove button #551

Merged
merged 1 commit into from
Jan 26, 2017

Conversation

vcanales
Copy link
Contributor

@vcanales vcanales commented Jan 26, 2017

Fixes #550

Checklist

Changes proposed in this pull request:

Add type attribute to remove buttons on Tag components, since not having type="button" submits forms that contain the element on some browsers.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @devjunkORG! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

nice catch!

vcanales added a commit to vcanales/blueprint that referenced this pull request Jan 26, 2017
vcanales added a commit to vcanales/blueprint that referenced this pull request Jan 26, 2017
@@ -35,7 +35,8 @@ export class Tag extends React.Component<ITagProps, {}> {
return (
<span {...removeNonHTMLProps(this.props)} className={tagClasses}>
{this.props.children}
{isFunction(onRemove) ? <button className={Classes.TAG_REMOVE} onClick={onRemove} /> : null}
{isFunction(onRemove) ? <button type="button" className={Classes.TAG_REMOVE} onClick={onRemove} />
: null}
Copy link
Contributor

Choose a reason for hiding this comment

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

pull this out to a local variable or bring back to one line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was doing just that. Also, I'm sorry, I added PR metadata to the commit message before I should have.

vcanales added a commit to vcanales/blueprint that referenced this pull request Jan 26, 2017
comply with linting rules

PR: palantir#551

refactor button, move to variable
vcanales added a commit to vcanales/blueprint that referenced this pull request Jan 26, 2017

return (
<span {...removeNonHTMLProps(this.props)} className={tagClasses}>
{this.props.children}
{isFunction(onRemove) ? <button className={Classes.TAG_REMOVE} onClick={onRemove} /> : null}
{isFunction(onRemove) ? button : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

i meant pull the whole statement out. no need to create the object when the function is false. this should say just {button}

also please use undefined instead of null.

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

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

thanks! for the record, if you're gonna fix something immediately then there's no need to file an issue. just submit the fix directly!

@giladgray giladgray merged commit 5e8adaf into palantir:master Jan 26, 2017
@vcanales
Copy link
Contributor Author

no need to file an issue. just submit the fix directly!

will keep that in mind, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants