Several deprecated ARIA roles are being suggested in rule typescript:S6819.
See WAI-ARIA Roles - Accessibility | MDN
Forcing these deprecated tags to be used is not best practice and sprinkling NOSONAR
all over the place is also not ideal.
Several deprecated ARIA roles are being suggested in rule typescript:S6819.
See WAI-ARIA Roles - Accessibility | MDN
Forcing these deprecated tags to be used is not best practice and sprinkling NOSONAR
all over the place is also not ideal.
I’ve also noticed these strange rules, particularly requiring <menuitem>
a long deprecated html tag
Hello,
@tim-soft Could you point us to the spec where this is deprecated? On the MDN webpage, it is not mentioned.
@efenderbosch - Could you mention, which roles you are referring to?
Cheers,
Michal
From the MDN page I linked:
Avoid using button, checkbox, gridcell, link, menuitem, menuitemcheckbox, menuitemradio, option, progressbar, radio, and textbox, which we’ve included for completeness.
Additionally caniuse.com will show if a feature is supported or deprecated.
None of these roles (which are not to be confused with elements!) are deprecated in WAI-ARIA 1.2. As currently worded, that statement on MDN is misleading.
Related questions:
Is there any way to configure this rule? Our in-house best practices say to not use menuitem
but this rule is forcing the addition of //NOSONAR
every place that has role="menuitem"
.
Rule configuration seems to be blatantly missing from Sonar. Most other quality gate tools allow rules to be tweaked to account for organizational and team best practices. It would be great if we could just turn off enforcement for deprecated roles like menuitem
.
Do you have a code fragment that allows others to reproduce this issue? I copied the W3C’s APG code for Actions Menu Button Example Using aria-activedescendant in VSCodium and Sonar did not ask me to replace <li id="mi1" role="menuitem">
with <menuitem>
(which is non-conforming according to the WHATWG’s HTML spec).
Why do the in-house rules prohibit the perfectly valid role="menuitem"
? This makes no sense to me.
Hello @tim-soft,
can you please clarify if the rule is asking you to use <menuitem>
html element? If that’s the case, that’s indeed not expected.
@efenderbosch Can you please clarify what is the deprecated roles being suggested? In principle that rules does not suggest roles, but HTML tags instead, so I’m not sure I understand the issue.
The rule will look for usages of ARIA roles for which semantic HTML tags exist and should be used instead. So I don’t understand what you mean by “ARIA roles are being suggested”.
In any case, I see the value in being able to customize this rule with a whitelist of ARIA roles, so I’ve created a ticket to implement that in HTML and JS/TS analyzers
Cheers,
Victor
That’s exactly what it is doing.
Could you please identify the Sonar product that produces this message? I’m asking this because I couldn’t reproduce this with SonarLint in VSCodium.