krautzource/sre-to-tree

re-evaluate non-tree roles

Closed this issue · 5 comments

pkra commented

In particular, do we have working links?

pkra commented

In particular, do we have working links?

Not really. MathJax treats anchors poorly and it seems difficult to fix this here. We'd also need activation logic in aria-tree-walker. And then there's the issue of the achor being in the tab order. Yikes, this is a mess.

pkra commented

In https://w3c.github.io/aria-practices/examples/treeview/treeview-navigation.html, anchors role=treeitem and tabindex=-1 - JS then adds keyDown events for enter and space to follow the link.

Now we only have to fix the SRE/MathJax markup.

pkra commented

As per F2F, @zorkow will take a look at how SRE might expose links.

pkra commented

After more digging around and testing I think we can remove

sre-to-tree/lib.js

Lines 31 to 36 in 90391d2

if (
node.hasAttribute('role') ||
node.tagName === 'A' ||
node.tagName === 'IMAGE'
)
return;

a) anchor tags can and should be treeitems
b) image tags might as well be treeitems - we unintentionally set them to role=presentation later via

sre-to-tree/lib.js

Lines 152 to 154 in 90391d2

descendantNodes.forEach((child) => {
if (!child.getAttribute('role')) child.setAttribute('role', 'presentation');
});
(and we forgot about img tags)
c) if we find a use case for a role that should not be rewritten, we can revisit preserving those; right now we don't have a use case.

pkra commented

For the record, tabindex=-1 should be set upon tree activation (as progressive enhancement, e.g., krautzource/aria-tree-walker#22).