SSAgov / ANDI

A tool to test web content for accessibility and 508 compliance.
https://www.ssa.gov/accessibility/andi/help/howtouse.html
Other
293 stars 75 forks source link

ANDI fails to work on pages running jQuery Slim #226

Closed damionmounts closed 4 months ago

damionmounts commented 4 months ago

Running ANDI on a site with jQuery Slim loaded causes errors where the $().slideUp and $().slideDown functions cannot be found - notably, these functions are excluded from the slim build of jQuery.

Running ANDI on the same site, but with jQuery Slim's <script> commented-out - causes it to work fine.

image

jQuery().jquery can be leveraged to get the version and removed features.
Here is the output of running it in my scenario with Slim loaded:

"3.7.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween"

It's somewhere in effects that slideUp and slideDown live.

There is a method for loading multiple jQuery versions - perhaps that could be leveraged if Slim is detected.
Or to just always load a full-fat version of jQuery. https://api.jquery.com/jQuery.noConflict/

JohnCotterSSA commented 4 months ago

Thanks for the detailed analysis.

What I will do is check to see if slideup / slidedown are already defined by jquery, and if not, I'll define them so that those javascript errors won't occur anymore when an app is using jquery slim.

JohnCotterSSA commented 4 months ago

Issue is fixed in 29.1.1 Will be available later today. Let us know if you experience additional issues.

damionmounts commented 4 months ago

Thank you! It's working just fine now - confirmed that both ANDI 29.1.1 and jQuery Slim 3.7.0 were in use.