Categories
HTML5

If it had remained the irrelevant attribute

Recovered from the Wayback Machine.

The latest round of discussions related to longdesc (yes, still) was triggered by a revert request from Laura Carlson:

As you know the editor made changes to the hidden section [1]. This biases an open issue [2] as it directly implements a material change from a change proposal [3]. The Chairs specifically asked for justification for this change in their change proposal review [4]. If the proposal lacks justification, then the spec lacks justification.

The change redefined the meaning for the hidden attribute, from:

When specified on an element, it indicates that the element is not yet, or is no longer, relevant. User agents should not render elements that have the hidden attribute specified.

Elements that are not hidden should not link to or refer to elements that are hidden.

It would similarly be incorrect to use the ARIA aria-describedby attribute to refer to descriptions that are themselves hidden. Hiding a section means that it is not applicable or relevant to anyone at the current time, so clearly it cannot be a valid description of content the user can interact with.

To:

When specified on an element, it indicates that the element is not yet, or is no longer, directly relevant to the page’s current state, or that it is being used to declare content to be reused by other parts of the page as opposed to being directly accessed by the user. User agents should not render elements that have the hidden attribute specified.

Elements that are not themselves hidden must not hyperlink to elements that are hidden. The for attributes of label and output elements that are not themselves hidden must similarly not refer to elements that are hidden. In both cases, such references would cause user confusion.

Elements and scripts may, however, refer to elements that are hidden in other contexts.

It would be fine, however, to use the ARIA aria-describedby attribute to refer to descriptions that are themselves hidden. While hiding the descriptions implies that they are not useful alone, they could be written in such a way that they are useful in the specific context of being referenced from the images that they describe.

Similarly, a canvas element with the hidden attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control could refer to a hidden form element using its form attribute.

The change significantly redefines the meaning for the hidden attribute. Why did the editor make this change? One reason was, as Laura pointed out, bolstering a change proposal to obsolete longdesc in favor of a proposal to use aria-describedby pointing to a section marked by the hidden attribute.

This triggered two separate discussions—one related to making an edit to HTML5 specifically in favor of a change proposal currently under rather contentious debate; the second related to redefining hidden in such a way that aria-describedby would be allowed to point to it.

The revert request was successful, which now leaves the discussion about allowing aria-describedby to point to content marked with the hidden attribute, and this change’s impact, or not, on the decision to deprecate longdesc. I’m not going to get into the longdesc deprecate debate—my views on this are widely known and I’ve long been in support of keeping this attribute in the HTML spec. Instead, I want to focus on the change to hidden.

A recent post to the HTML-WG mentioned separating the aria-describedby/hidden issue into a separate survey (and there’s now an issue for it). However, I wanted to remind the HTML-WG co-chairs that they already decided this issue back in 2010.

In 2010 I made a request to remove the hidden attribute from HTML5. In the change proposal to support the request, I wrote:

The hidden attribute was once named the irrelevant attribute, supposedly because the attribute is used to mark the contents of whatever element it is attached as “irrelevant”. The attribute was renamed because, a) the irrelevant term was confusing, and b) techs misspell words like “irrelevant”.

Is the content truly irrelevant, though? Consider the definition for the attribute:

Elements in a section hidden by the hidden attribute are still active, e.g. scripts and form controls in such sections still execute and submit respectively. Only their presentation to the user changes.

“An irrelevant element is not one that is active, receiving events, participating in the web page, or form submission. The only truly irrelevant page component is one that doesn’t exist. If people want a truly irrelevant page section, they should use the DOM to create and remove the element, as needed. There is nothing about the behavior associated with removing an element from user agent rendering that is made more meaningful using a single-purposed HTML attribute, rather than using a simple combination of CSS property and ARIA attribute. Both have to do with the presentation of the element.”

Presentation with the hidden attribute isn’t an incidental purpose, it is the primary purpose of the attribute. Rather than separate presentation and structure, it firmly welds the two.

My request to remove hidden wasn’t successful, based on the strength of arguments in favor. What were these arguments? The following is the primary one, from the counter-proposal:

Authors of web documents and applications often need to temporarily hide certain content from readers and users. Via a combination of script and CSS, such functionality is possible to build today, and there are hundreds of such implementations extant on the web. It’s clear that hidden=”” Solves Real Problems. Attempting to implement such functionality with JavaScript and CSS is fundamentally more difficult and error-prone than hidden=””. hidden=”” is literally the simplest thing that could possibly work, and thus we Avoid Needless Complexity in its design. By making it as easy as possible to author, and by defining uniform UA behavior (unlike bolt-on scripts which emulate this functionality), we preserve our Priority of Constituencies. Bolt-on emulations of hidden=”” can fail to correctly hide content in a media-independent way, resulting in a degraded experience for users of aural browsers and other AT tools. hidden=”” thus promotes Accessibility more than bolt-on alternatives.

In the survey deciding the issue of keeping hidden or not, several arguments in support of keeping hidden were given.

Cynthia Shelly wrote:

The existing mechanisms all miss one case or another, and it is complicated to understand when to use one over another. The new hidden attribute covers all the cases in a way that will make it much simpler to include markup on a page that is intended as input to a script rather than output to a user.

Gregory Rosmaita wrote:

a native solution which provides the means of marking content as not yet or no longer relevant, is highly desireable; while such a feature, of course, needs to be harmonized with what ARIA offers, it MUST be remembered that aria-hidden is part of a bridging vocabulary, which provides semantics and functionalities which native markup does not provide; the hiding and exposition of content that is not yet, or is no longer, relevant should not be left to scripting or an overlay such as ARIA, but should be an organic part of HTML5.

Jonas Sicking wrote:

I object to removing the hidden attribute as it would result in missing out of the positive effects listed in http://www.w3.org/html/wg/wiki/ChangeProposals/KeepNewElements#Positive_…

My experience working with web authors for several years is that they tend to do what is easy, whereas accessibility often ends up coming second due to time constraints and unawareness.

By including the semantic hidden element, we both make it easier for developers to do what they want, since they can use the .hidden IDL attribute, and they automatically get the desired semantic meaning.

I think it’s very unlikely that as many people would add proper ARIA attributes, as would use the hidden attribute. I think this is the reason that the WAI-ARIA specification encourages developers of markup languages to add semantic elements and explicitly declares ARIA as a bridge technology. I also think this is why the HTML Accessibility TF has endorsed the hidden attribute.

Among the arguments was the assertion that the hidden attribute is equivalent to aria-hidden, but better because the hidden attribute was integrated into the HTML semantics, rather than be “bolted on” via ARIA. Since aria-hidden is used specifically to designate material that is not perceivable to any user, this adds weight to the interpretation of content that is marked as hidden is content that is irrelevant to all users—at least until such time the hidden attribute is removed (equivalent to setting aria-hidden to “false”).

The co-chairs agreed with those who argued in favor of keeping hidden, writing:

It seems that the hidden attribute serves a valid, broad use case. It has interest from implementors and authors.

A number of arguments were made in favor of retaining the hidden attribute. It was argued with partial success that hidden captures useful semantics. Many cited the accessibility benefits of built-in elements and attributes, including hidden. A number of other concrete benefits were cited, such as likelihood of surviving syndication. These positive arguments were in general stronger than the counter-arguments, and provided strong reasons to keep hidden.

There were also arguments made against the hidden attribute. It was argued that CSS+ARIA-based implementations of hidden-like functionality are sufficient, so no attribute is needed. Deployment costs were also cited as a concern. And the semantic nature of the attribute was cast in doubt. In general, these arguments did not overcome the counter-arguments, and are not strong reasons to remove hidden.

The maturity argument against hidden had more weight. The Working Group has in the past chosen to remove features from the draft for reasons of maturity. However, this factor was not decisive in itself, at least at this time, since the W3C Process allows further opportunities for review, implementation and feedback.

Overall, the arguments in favor of keeping hidden were stronger than the arguments for removing it. Only the maturity argument provided a strong reason for removal, and it is outweighed by the arguments in favor of keeping it.

In my opinion, the decision was not necessarily a model of clarity. However, I do believe that this 2010 decision answers the question whether aria-describedby can point to an element marked with the hidden attribute, and the answer is, No.

An attribute used to designate content that is available for scripting purposes is not the same as an attribute that is used to remove the content from visual display. Why? because one implies the same result regardless of type of browser accessing the page, while the other implies something completely the opposite.

My understanding of the decision in 2010 is that “hidden” meant that the material was irrelevant regardless of type of browser accessing the page. This is supported by the fact that at one point in time, the hidden attribute was named irrelevant. The reason the name of the attribute was changed was more one of expediency than change of semantics. The visibility of the content should make no difference on whether it is relevant or not.

As the HTML5 editor, Ian Hickson, wrote when he renamed irrelevant to hidden:

It’s not different from hiding content that isn’t necessary. That’s exactly what it is. It’s a way to hide content that isn’t currently relevant.

I challenged the hidden attribute years ago because it seemed to me it was nothing more than an elemental equivalent of display: none. However, others, including the co-chairs, disagreed with me, and agreed with the HTML5 editor: the hidden attribute had the additional semantics related to its irrelevancy.

Based on this decision two years ago, I’m at a loss to understand why the HTML5 co-chairs would consider an option to allow aria-describedby to link to this content so that it can be rendered by screen readers—in effect, to make the content in the element with the hidden attribute, relevant. Something cannot be both relevant and irrelevant at the exact same time.

Print Friendly, PDF & Email