-
Notifications
You must be signed in to change notification settings - Fork 58
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
fix(atom/button): avoid following the link if link button is disabled #871
Conversation
@@ -17,7 +17,7 @@ const Button = ({ | |||
return link ? ( | |||
<Link | |||
{...attrs} | |||
href={href} | |||
href={!disabled && href} |
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.
Corrigeme si me equivoco pero si disabled
es false
el valor de la prop href
seria false
?
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.
No, si disabled=false
el resultado de la condición será true
y, por tanto, el atributo href
tendrá el valor de la propiedad href
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.
Pero cuando disabled
es true
la prop href
tendrá valor false
. El enlace del componente tendrá href=false
?
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.
Cuando la prop href es false
, el atributo no existirá.
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.
merci. Me lian a veces los short circuits
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.
Perfecto! Gracias
Issue (#387):
If an
atom-button
type link is disabled, the link still works.Expected behavior:
If an
atom-button
type link is disabled, the link shouldn't work.Solution:
We can prevent the link navigation using the
disabled
prop of theatom-button
.