w3c / core-aam

Core Accessibility API Mappings
https://w3c.github.io/core-aam/
Other
38 stars 10 forks source link

Mappings for form are very confusing, containing infinite logic loop #159

Open aleventhal opened 1 year ago

aleventhal commented 1 year ago

Looking at: 1) https://w3c.github.io/core-aam/#mapping_role_table 2) https://w3c.github.io/html-aam/#html-element-role-mappings

When an element with role=form is nameless, core-aam says "Do not expose the element as a landmark. Use the native host language role of the element instead.". This means to use html-aam.

In html-aam, some of the mappings say, "Use WAI-ARIA mapping", which sends us right back to the same place in CORE-AAM, causing a loop. Other mappings are explicity wrt a form with an empty name.

The whole thing is very confusing and difficult to follow.

We're trying to fix https://bugs.chromium.org/p/chromium/issues/detail?id=1343081, but I'm not sure what is required.

@spectranaut @scottaohara

scottaohara commented 1 year ago

I think the "Use the native host language role of the element instead." of the nameless form table in core aam is probably the part we do not want/need.

Where this ended up, so long after Carolyn had originally made that PR, was to allow a form to still expose a form role if AT felt necessary, but not expose it as a landmark if it was not named.

In HTML AAM, form without a name was originally mapping to generic - but that was removed https://github.com/w3c/html-aam/pull/372

That HTML AAM issue was being tracked against https://github.com/w3c/core-aam/issues/100 which is still open, and was logged after the merged https://github.com/w3c/core-aam/pull/97 that is being referenced in the chromium bug.

So seems there are a number of things that were going on here?

aleventhal commented 1 year ago

So, we should use ATK_ROLE_FORM only if there is NOT a name, otherwise use ATK_ROLE_LANDMARK. Correct?

Nit: the CORE-AAM table refers to ROLE_FORM when it should say ATK_ROLE_FORM.

aleventhal commented 1 year ago

For IA2 nameless forms, what does it mean, "Do not expose the element as a landmark." -- how were we exposing it as a landmark other than via IA2_ROLE_FORM?

And it seems strange that IA2 still exposes it with a form role when there's a name, but ATK does not.

spectranaut commented 1 year ago

| Nit: the CORE-AAM table refers to ROLE_FORM when it should say ATK_ROLEFORM. Actually it looks like CORE-AAM regularly drops the "ATK" prefix from the atk/atspi roles, so it is consistent.

I read @carmacleod's comments in this issue: https://github.com/w3c/core-aam/issues/100

Also it seems to me like we should update CORE-AAM, not HTML-AAM, to:

Form with name (the same except IA2):

Form without name should be updated to:

If we do this, then we can remove the extra note for ATK from HTML-AAM (https://w3c.github.io/html-aam/#el-form ) because it would be redundant. And then HTML-AAM would point to CORE-AAM, and all the information you need about form mapping (native elements or role forms) would be in once place.

aleventhal commented 1 year ago

I guess I don't understand why we should change IA2_ROLE_FORM to IA2_ROLE_LANDMARK when there is a name. The AT can already determine that there is a landmark from it being an IA2_ROLE_FORM with a name. If we change it to IA2_ROLE_LANDMARK, we make it harder for the AT to determine what kind of landmark it is.

Same with the other APIs, TBH.

spectranaut commented 1 year ago

All the other landmarks in CORE-AAM have IA2_ROLE_LANDMARK so I presume they decipher which landmark by the xml-roles. The change I proposed would make the form landmark consistent with all the other landmarks. I'm not sure if microsoft ATs treat named forms with the role IA2_ROLE_FORM as landmarks.

Here is a test case

aleventhal commented 1 year ago

I'll bring this up with various AT devs and ask what they want. Bottom line is that I think we want a user experience where a nameless form is not in the landmark cycle. That seems a little weird to me too -- most forms aren't named, and even just knowing where one is might be useful. But I'm sure there was some reasoning behind it. Perhaps there's already a key to navigate to the next form.

aleventhal commented 1 year ago

BTW, the Microsoft ATs don't use IA2 at all, they use UIA.

scottaohara commented 1 year ago

simply linking the issues about this topic https://github.com/w3c/aria/issues/1764

jcsteh commented 4 months ago

We're hitting the same challenge as we try to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1778795. It's actually even worse than is described above though:

  1. Core AAM says that a form without a name should get a computed role of "form".
  2. The Handling Author Errors section of the ARIA spec contradicts this, saying it should fall back to the host language role.
  3. As described here, the host language role maps to the ARIA role.
  4. The WPT test agrees with ARIA's Handling Author Errors here; i.e. role="form" with no name maps to the computed role of the host language, not "form".

I guess I don't understand why we should change IA2_ROLE_FORM to IA2_ROLE_LANDMARK when there is a name. Same with the other APIs, TBH.

We don't really need that for IA2, but I think that idea came from ATK, where it's much easier to find landmarks by querying for ATK_ROLE_LANDMARK than it is to have a complex query which also checks for named forms.

That seems a little weird to me too -- most forms aren't named, and even just knowing where one is might be useful.

I think it relates to <form> being misused or at least over-used. See https://github.com/w3c/core-aam/issues/11#issue-325089950. What I can say is that too many landmarks makes landmark navigation worse than useless, though I can't personally speak specifically about nameless forms being landmarks because i haven't done any analysis on that myself.

CC @nmlapre.