Skip to content

Why is the content model for <button> limited to phrasing content? #9705

Open
@mfreed7

Description

@mfreed7

The spec for <button> says:

Content model:Phrasing content, but there must be no interactive content descendant and no descendant with the tabindex attribute specified.

This issue is to ask: why the phrasing content limitation? (The interactive content limitation makes total sense.) I've asked around with some a11y folks, and as far as I've heard, this is unrelated to accessibility. It may be historical, from a time before CSS could be used change inline/block/etc. There would seem to be some very valid use cases for using a non-phrasing element like a <div> inside a button, such as for layout reasons.

I searched for other related issues, and could only find this one in WHATWG, and these two (888, 1332) on the validator. None gave particularly satisfying rationale.

This content model rule, AFAIK, is just a validator issue, since all browsers properly and interoperably parse and render <button><div></div></button>. And changing it would be a relaxation of the validator, which would seem to be backwards compatible.

Any reason not to relax the content model for <button>?

@scottaohara @sideshowbarker @aleventhal @una

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions