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

button in anchor should throw an error #565

Closed
thisconnect opened this issue Jun 1, 2020 · 3 comments
Closed

button in anchor should throw an error #565

thisconnect opened this issue Jun 1, 2020 · 3 comments

Comments

@thisconnect
Copy link

A button inside an anchor, doesn't make much sense and throws an error in w3's validator
https://validator.w3.org/nu/#textarea

Error: The element button must not appear as a descendant of the a element.

Would be nice if html-proofer would catch and error too.

minimal example

<!doctype html>
<title>no button in anchor</title>
<meta charset="utf-8">
<a href="https://base.shiftcrypto.ch/">
    <button class="button primary shadow">View documentation</button>
</a>
@fulldecent
Copy link
Collaborator

Please cite relevant specification in WHATWG if possible.

@thisconnect
Copy link
Author

thisconnect commented Jul 2, 2020

Content model:
Transparent, but there must be no interactive content descendant, a element descendant, or descendant with the tabindex attribute specified.

And in the example:

The a element can be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g., buttons or other links).

https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element

@gjtorikian
Copy link
Owner

Hi—the next version of HTMLProofer won't have HTML checking at all anymore. I am going to close this issue out, as I'm just one person and can't maintain both the 3.x and 4.x features. ✌️

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

No branches or pull requests

3 participants