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

onClick prop is excluded when href prop is provided in EuiBadge #4031

Closed
TAYTS opened this issue Sep 12, 2020 · 1 comment · Fixed by #4035
Closed

onClick prop is excluded when href prop is provided in EuiBadge #4031

TAYTS opened this issue Sep 12, 2020 · 1 comment · Fixed by #4035

Comments

@TAYTS
Copy link
Contributor

TAYTS commented Sep 12, 2020

When the href prop is provided for the <EuiBadge>, the onClick prop is excluded, may I know is this the design choice or it is a bug?

Here is the code snippet that exclude the onClick prop:

if (href && !isDisabled) {
relObj.href = href;
relObj.target = target;
relObj.rel = getSecureRelForTarget({ href, target, rel });
} else if (onClick) {
relObj.onClick = onClick;
}

@cchaos
Copy link
Contributor

cchaos commented Sep 14, 2020

Originally we had restricted the use of both href and onClick on the same element mainly because of accessibility and semantics. We have started lightening up on these restrictions because we now know that routing SPA's like React-router sometimes needs both in order to support right clicking. We've then moved towards allowing both but we have a Eslint warning for consumers to acknowledge that this is in fact what they want.

So, good catch, we should open this component up to allow both.

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 a pull request may close this issue.

2 participants