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

Web Collapse JS: data-toggle on a link does not prevent navigation to the link #1361

Open
literat opened this issue Apr 22, 2024 · 1 comment

Comments

@literat
Copy link
Collaborator

literat commented Apr 22, 2024

Clicking on the toggle on the link starts navigation to # (see demo):

<a href="#" role="button" data-toggle="collapse" data-target="CollapseExampleIV" class="Button Button-tertiary Button-medium"> Tertiary Collapse trigger
</a>
@adamkudrna
Copy link
Contributor

I'm rather seeing a problem in <a href="#" role="button"> itself. <a> is an anchor, designed for links. role overrides its default role link to button which indicates a <button> should be used instead of <a>. Since we allow buttons to visually appear as links, I think we should rather educate users and advice against using wrong HTML. So, if the code above is in our docs, I think we should remove it. To be completely sure, we can contact the product design systems before doing so.

cc @crishpeen

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

No branches or pull requests

2 participants