Trailing space in ARIA attribute ID reference list causes validation error

A trailing space in a space-separated list of IDREFs in @aria-controls
or @aria-labelled causes validation errors. An example of the error
message is "The aria-controls attribute must point to an element in
the same document." Removing the trailing space clears the error.

Consider the following HTML:

--- html begins ---

<button type=button class=accordion-expand
aria-controls="accordion-content-195 accordion-content-196
accordion-content-197 accordion-content-198 ">Trailing space</button>

<a href="#" aria-labelledby="accordion-content-195
accordion-content-196 accordion-content-197 accordion-content-198
">Foo - trailing space</a>

<button type=button class=accordion-expand
aria-controls="accordion-content-195 accordion-content-196
accordion-content-197 accordion-content-198">No trailing
space</button>

<a href="#" aria-labelledby="accordion-content-195
accordion-content-196 accordion-content-197 accordion-content-198">Bar
- no trailing space</a>

<div id="accordion-content-195">block 1</div>
<div id="accordion-content-196">block 2</div>
<div id="accordion-content-197">block 3</div>
<div id="accordion-content-198">block 4</div>

--- html ends ---

The first button and link pair have aria attributes with
space-separated ID references with a trailing space, while the second
pair don't. The errors are raised only for the first button and link.

The algorithm for parsing space separated tokens [1] suggests this is a bug.

Jason


[1] http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#set-of-space-separated-tokens

Received on Wednesday, 20 May 2015 01:38:30 UTC