accname icon indicating copy to clipboard operation
accname copied to clipboard

Trim whitespace from computed accessible name/description

Open AlexLloyd0 opened this issue 4 years ago • 9 comments

Should whitespace be trimmed from the returned accessible name or description? e.g.

<button aria-label=" Hello world ">Hi</button>

My reading of the spec is that the accessible name should be " Hello world ", but browsers expose it as "Hello world", which is more logical to me. Possibly related to #16

AlexLloyd0 avatar Nov 25 '20 11:11 AlexLloyd0

From 2021/06/03 meeting: <Jory> msumner: thinks we should trim whitespace, there are quirks where not doing that breaks stuff. In FF spaces in options have caused an issue

<Jory> jamesn: do we mean at the end of the calculation or during it?

<Jory> msumner: what to implementers think?

<Jory> sarah_higley: would advocate for at the end

<Jory> jcraig: there was some discussion about collapsing multiple whitespace.. is this trimming at the end or ANY whitespace?

<Jory> jcraig: we need to be careful about inadvertently adding whitespace that the author did not intend

<Jory> joanie: thinks the example of starting and ending with a space is sub-optimal authoring, but we should not trim

<Jory> msumner: the spaces may be unintentional, e.g. a side-effect of a CMS

<Jory> jamesn: there are 9 open acc name whitespace issues, this would be the 10th

<Jory> msumner: will look at this set of issues and categorize them

jnurthen avatar Jun 16 '21 04:06 jnurthen

joanie: thinks the example of starting and ending with a space is sub-optimal authoring, but we should not trim

To be clear: Joanie thinks other trimming is good (e.g. at the end of calculation, and when it is NOT whitespace intentionally added by the author like in the opening report)

joanmarie avatar Aug 30 '21 15:08 joanmarie

Agenda+ since this is coming up in the context of the Interop Accessibility Focus Area

cookiecrook avatar Apr 04 '24 16:04 cookiecrook

@w3c/aria-editors please add new milestone for 2024... Need to resolve this for Interop 2024 so we don't have to pull out the WPT tests from the Accessibility Focus Area.

cookiecrook avatar Apr 04 '24 17:04 cookiecrook

FWIW, we did remove/change the nbsp tests in WPT, because the ARIA spec resolved on ASCII whitespace, which does not include non-breaking space.

cookiecrook avatar Apr 20 '24 16:04 cookiecrook

Discussed in https://www.w3.org/2024/05/09-aria-minutes.html#t08 Decision to deep dive all accname whitespace issues after @MelSumner does a review/categorizing of them

spectranaut avatar May 09 '24 18:05 spectranaut

@MelSumner, are you coming to TPAC, either remotely or in person? Would you be interesting having an agenda item at TPAC for these whitespace issues?

spectranaut avatar Jul 25 '24 18:07 spectranaut

@spectranaut I am not able to attend due to previous commitments, but I am actively working on the issue.

I could possibly do a virtual attendance on the Wednesday during TPAC if there's room on the agenda and folks will be around.

If not, then first deep dive after TPAC, if that works?

MelSumner avatar Aug 08 '24 16:08 MelSumner

Reading here, Computation Step 2D:

AriaLabel: Otherwise, if the current node has an aria-label attribute whose value is not undefined, not the empty string, nor, when trimmed of whitespace, is not the empty string:

"nor, when trimmed of whitespace" seems kind of specific IMO. WDYT?

For aria-labelledby and aria-describedby, they can point to multiple id attributes, so probably shouldn't trim whitespace inside of those attribute values.

However, there's a whole other conversation about what to do with different types of whitespace in the elements those id attribute values point to, and we're dealing with those in multiple separate issues.

MelSumner avatar Aug 08 '24 20:08 MelSumner