Skip to content

Proposal to Rephrase Success Criterion 4.1.1 #2525

Description

@cstrobbe

Since many accessibility testers and other accessibility experts erroneously interpret the phrase "elements are nested according to their specifications" as referring to content models instead of syntactical nesting, a rewording that avoids this misunderstanding is highly desirable. Below is a proposed rewording.

In content implemented using markup languages, the following are true, except where the specifications for the markup languages being used allow exceptions to these requirements:

  1. elements have complete start and end tags,
  2. elements are nested according to the syntactical rules of their specifications,
  3. elements do not contain duplicate attributes, and
  4. any IDs are unique.

Note: Start and end tags that are missing a critical character in their formation, such as a closing angle bracket or a mismatched attribute value quotation mark are not complete.

Note: Syntactically correct nesting is distinct from nesting according to the content models specified in a technical specification. The second condition of the success criterion does not require correct content models; only correct syntax.

Note: When a scripting language is used to manipulate elements or attributes (or both) in the Document Object Model, the resulting in-memory representation is still regarded as "content implemented using markup languages".

Description of the changes:

  • The second condition has been reworded to highlight syntactical correctness (as opposed to validity of content models).
  • The second note, which is new, draws attention to this. The first note is identical to the note in the WCAG 2.1 recommendation from June 2018.
  • The numbering is new; the phrase "the following are true" is copied from other success criteria, such as SC 1.2.1 and SC 2.2.2.
  • The third note addresses an issue unrelated to the distinction between correct syntax and validity.

Compatibility with existing versions of WCAG 2 and EN 301 549: Since the proposed rewording results in a requirement that is less strict than the interpretation of most accessibility testers, all documents that pass the current version of SC 4.1.1 should also pass its proposed rewording. In this sense, the proposed rewording is compatible with the current version.

Clause 9.4.1.1 of EN 301 549 says, "Where ICT is a web page, it shall satisfy WCAG 2.1 Success Criterion 4.1.1 Parsing". Unless the editors of EN 301 549 want to retain the current version of the success criterion, no rewording of clause 9.4.1.1 is needed beyond, at some future point in time, an update of the referenced version of WCAG.

Not addressed by this proposal: The proposal does not address whether unbalanced attribute quoting counts as a failure of SC 4.1.1. (See the discussion on the failure examples in F70.) The first note mentions "a mismatched attribute value quotation mark" as an example an incomplete start tag, but notes are non-normative and the SC does not say anything about attribute syntax. Adding a fifth condition, such as "attribute syntax is used according to specification", might therefore be interpreted as making the SC stricter than in WCAG 2.1.


The intent of this rephrasing is not to “defend” the many types of validation errors that accessibility testers flag using this success criterion. My intent is merely to eliminate a common misunderstanding about what the success criterion actually means. (See my comment on issue w3c/wcag#978 for notes about how XML's concept of well-formedness informed the wording of the success criterion.) If non-syntactical validation errors which impact accessibility are found, these should be caught either by existing success criteria or by new ones that still need to be created.


Clarification in response to Alastair Campbell's comment on content models (18.07.2022).
"Content models" refers to the descriptions of what each element may contain. For example, in HTML 5 a div may not be nested inside a span. In SGML and in the early days of XML, content models were described in DTDs. For example,
<!ELEMENT chapter (chaptertitle, (para | heading)+)>
This line declares the element chapter and says it must contain a chaptertitle followed by at least one para or heading. In HTML 5, content models are not expressed in DTDs, XML Schemas or similar formal languages, but described in text. See, e.g. "content model" under The section element, which says that this element may only contain flow content.

Activity

  1. bruce-usab commented on Jun 27, 2022

    @bruce-usab
    Contributor

    @cstrobbe I am very grateful for your close analysis and explanation. That said, AGWG has had great difficulty advancing two considerably more trivial (and essentially editorial) changes to normative phrasing in 2.0.

    My own preference would be to incorporate all of this into Understanding and other related supporting materials, as you are doing, for example with #2187.

  2. GreggVan commented on Jun 27, 2022

    @GreggVan
  3. cstrobbe commented on Jun 28, 2022

    @cstrobbe
    Author

    @GreggVan
    My rewording is based on what I remember from the discussions in the WG at the time, the statement in Success Criterion 4.1.1: Parsing that XML's well-formedness is close to what the SC requires (in other words, requiring correct content models goes beyond well-formedness and beyond the SC) and what I could reconstruct from publicly available older discussions (see my comment on What does nested according to the specification mean in SC 4.1.1). The rationale for my proposal is that it represents what was always intended.

    I understand that we can't contact everyone who was involved in those discussions, but a clarification on what "nested according to their specifications" means has been requested for years. If WCAG 2.2 adopted the proposed wording, non-compliance with older versions would be caused by auditors going beyond the intent of the current SC 4.1.1. If this is better handled by means of errata, then I'm perfectly happy with that.

  4. JAWS-test commented on Jul 2, 2022

    @JAWS-test
  5. alastc commented on Jul 18, 2022

    @alastc
    Contributor

    I think the test for an errata would be whether this would clarify the SC without changing the intended meaning:

    "In content implemented using markup languages, elements have complete start and end tags, elements are nested according to the syntactical rules of their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features."

    The understanding document includes phrases like:

    the content is created according to the rules defined in the formal grammar for that technology. In markup languages, errors in element and attribute syntax and failure to provide properly nested start/end tags lead to errors that prevent user agents from parsing the content reliably. Therefore, the Success Criterion requires that the content can be parsed using only the rules of the formal grammar.

    The concept of "well formed" is close to what is required here.

    I'm not entirely sure what @cstrobbe meant by "content models", but the above seems like a reasonable suggestion for an errata.

  6. GreggVan commented on Jul 18, 2022

    @GreggVan
  7. cstrobbe commented on Jul 19, 2022

    @cstrobbe
    Author

    Gregg Vanderheiden wrote,

    If the spec says "there is no requirement to nest them strictly, but if you do then use this syntax"
    Your edit would have the effect of deleting the first half of the sentence - and only use PART of the spec that is syntax, and ignoring the part of the spec that says there is no requirement to.

    I think the wording of my suggestion avoided that issue:

    except where the specifications (...) allow exceptions to these requirements

  8. GreggVan commented on Jul 19, 2022

    @GreggVan
  9. patrickhlauke commented on Jul 19, 2022

    @patrickhlauke
    Member

    BY THE WAY - the INTENT was 1 3 and 4 but NOT requiring strict nesting because HTML then did not require it. So you could have H1 H3 H1 H2 nesting and be ok
    There was a LOT of discussion and people who argued no H3 without H2, but in the end — what was agreed on did not require this.

    but that's not nesting, that's heading levels ... or am i missing something here?

  10. stevefaulkner commented on Jul 19, 2022

    @stevefaulkner

    Note: Syntactically correct nesting is distinct from nesting according to the content models specified in a technical specification. The second condition of the success criterion does not require correct content models; only correct syntax.

    So the following incorrect content model nesting is OK as far as the Criterion is concerned?
    <button><a href="#"></a></button>

    or

    <ul>
    <div>
    <li>
    <li>
    </div>
    </ul>
    
  11. alastc commented on Jul 19, 2022

    @alastc
    Contributor

    @GreggVan - My understanding that 4.1.1 is requiring correct nesting of tags, nothing to do with the order of headings (which are under 1.3.1).

    Like Steve's button / list example above (which fails in the validator as "Element div not allowed as child of element ul in this context").

    The proposed errata (adding "syntactical") could help to disambiguate the perception of it being more than what was intended.

    I'm fairly sure the spec on headings doesn't require any particular ordering of heading tags.

    However, it would catch things like <button><h2>Thing</h2></button>.

  12. cstrobbe commented on Jul 19, 2022

    @cstrobbe
    Author

    Regarding the examples in Steve Faulkner's comment: these don't contain syntactic problems, so they meet the SC. (Obviously, their content models are wrong, which is why the validator will report errors for those two examples.)

    As Alastair Campbell has pointed out, the hierarchy of headings is irrelevant to this SC. That is not a syntactical issue.

    The validator catches <button><h2>Thing</h2></button> because the content model is wrong. However, from a purely syntactical point of view, the nesting is fine (so it wouldn't violate SC 4.1.1). Browsers can build up an unambiguous parse tree based on that code. However, there may be an issue with the role exposed to the accessibility API. If that is the case, the code snippet violates a different SC, namely SC 4.1.2.

  13. patrickhlauke commented on Jul 19, 2022

    @patrickhlauke
    Member

    However, it would catch things like <button><h2>Thing</h2></button>

    but that's still going beyond syntax (well-formedness) ... so which is it?

  14. GreggVan commented on Jul 19, 2022

    @GreggVan
  15. alastc commented on Jul 21, 2022

    @alastc
    Contributor

    The validator catches <button><h2>Thing</h2></button> because the content model is wrong. However, from a purely syntactical point of view, the nesting is fine (so it wouldn't violate SC 4.1.1).

    I guess there is a difference between syntactical and content model that I'm missing.

    I thought that those types of errors were exactly what 4.1.1 were supposed to catch, i.e. nested according to the spec.

  16. 132 remaining items

  17. alastc commented on Jan 13, 2023

    @alastc
    Contributor

    Noting that this has been removed this from WCAG 2.2, but leaving open for potential updates to 2.1/2.0

  18. patrickhlauke commented on Nov 2, 2025

    @patrickhlauke
    Member

    Proposing to close this issue, as 2.0 https://www.w3.org/TR/UNDERSTANDING-WCAG20/ensure-compat-parses.html already mentions "syntax", and note 2 in 2.1 https://www.w3.org/TR/WCAG21/#parsing further clarifies this.

  19. moved this from To do to Drafted in WCAG 2.xon Nov 2, 2025
  20. patrickhlauke commented on Jan 26, 2026

    @patrickhlauke
    Member

    Discussed at the facilitator meeting today with @alastc @kfranqueiro @bruce-usab - agreed to close this as obsolete.

  21. moved this from Drafted to Done in WCAG 2.xon Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions