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

<a> must not appear as a descendant of <button> #1718

Open
speedyhoon opened this issue Apr 27, 2024 · 0 comments
Open

<a> must not appear as a descendant of <button> #1718

speedyhoon opened this issue Apr 27, 2024 · 0 comments

Comments

@speedyhoon
Copy link

Using validator.w3.org text-input to validate this HTML:

<!DOCTYPE html>
<html lang="">
<title>Test</title>
<button><a>hello</a></button>

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

But I expected not to receive any error.

The spec says <button> content allowed is:
Phrasing content, but there must be no interactive content descendant and no descendant with the tabindex attribute specified.

Then within interactive content, <a> is interactive when the href attribute is present.

So I was expecting this HTML:

<!DOCTYPE html>
<html lang="">
<title>Test</title>
<button><a href=/link>hello</a></button>

To return an error mentioning the href attribute the same as other interactive elements with attribute conditions.

<!DOCTYPE html>
<html lang="">
<title>Test</title>
<button><video controls>hello</video></button>
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

1 participant