fix(aria-allowed-attr): restrict br and wbr elements to aria-hidden only#4974
Conversation
b181510 to
76c9db8
Compare
WilcoFiers
left a comment
There was a problem hiding this comment.
@nami8824 Thank you very much for this contribution! It is greatly appreciated.
e5af01d to
43733a2
Compare
straker
left a comment
There was a problem hiding this comment.
Thanks for the changes. Sorry it took me so long to get to the I didn't notice you pushed changes and the pr still said changes requested. Overall it's looking, just a few things we'll need to fix before we can merge.
43733a2 to
c4af071
Compare
|
I've addressed the review feedback. Could you take another look? |
|
Wait... I see what you mean by the |
straker
left a comment
There was a problem hiding this comment.
Thanks for all the work you put into this!
There was a problem hiding this comment.
Sorry for the back and forth review. I found one minor thing that we should change. When the element has both global and non-global ARIA attributes, the resulting fix message is:
<br aria-busy="true" id="fail9" aria-expanded=false />
"Fix all of the following:
ARIA attribute is not allowed: aria-expanded=\"false\"
ARIA attributes are not allowed on br elements: aria-busy=\"true\", aria-expanded=\"false\""
This is because the aria-allowed-attr check fails for the non-global ARIA attribute aria-expanded, and then the new aria-allowed-attr-elm check also sees 2 attributes not allowed. I think the fix is to ignore non-global ARIA attributes in the new aria-allowed-elm-check that way the message doesn't have duplication.
"Fix all of the following:
ARIA attribute is not allowed: aria-expanded=\"false\"
ARIA attribute is not allowed on br elements: aria-busy=\"true\"
You can use the function get-global-aria-attrs to figure out which ones are global or not.
Split aria-allowed-attr check into role-based (aria-allowed-attr-role) and element-based (aria-allowed-attr-elm) checks. Add allowedAriaAttrs property to html-elms standard to define per-element ARIA attribute restrictions. br and wbr now only allow aria-hidden.
c4af071 to
f4eda3d
Compare
| const invalid = []; | ||
|
|
||
| for (const attrName of virtualNode.attrNames) { | ||
| if (validateAttr(attrName) && !allowedAriaAttrs.includes(attrName)) { |
There was a problem hiding this comment.
I removed validateAttr() because any attribute returned by getGlobalAriaAttrs() is already guaranteed to exist in standards.ariaAttrs.
|
Thanks for the review. I've updated |
Closes: #3177