trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
398 stars 80 forks source link

Minifiying `aria-hidden="true"` to `aria-hidden` is not recommended #230

Closed pbru87 closed 3 years ago

pbru87 commented 3 years ago

NUglify minifies aria-hidden="true" to aria-hidden.

According to Font Awesome, this should not be done:

Using property shorthand You might be tempted to use and leave the ="true" part out. Don't, it's important for screen readers to have a value that follows the spec.

If you run a website with just aria-hidden against Google Lighthouse, it also recommends to use the non-minified version aria-hidden="true" instead.

trullock commented 3 years ago

Are you aware of any screen readers which do require the ="true" for them to work properly? NUglify takes a very aggressive (but should be functional) approach to minification, much of the output is debatably not spec-compliant, but is correctly parsed by browsers.

Happy to "fix" this if its a real problem.

Can you repro an issue?

pbru87 commented 3 years ago

Hi Andrew, I have just set up a test web page, which can be found at https://www.patrick-brunck.de/temp/accessibility-test.html

The page contains test case 1 (aria-hidden="true") and test case 2 (aria-hidden).

Please open the web page via Mozilla Firefox, switch to the reader view and use its screen reader feature.

Test case 1 (aria-hidden="true") will not be read, but test case 2 (aria-hidden).

I hope this helps!

Best regards, Patrick

trullock commented 3 years ago

Ok great, are there other aria attributes which require the same treatment?

pbru87 commented 3 years ago

None that I know about. I just stumpled on this issue, because of the feedback I got from Google Lighthouse.

trullock commented 3 years ago

Fixed in 1.13.2