medialize / ally.js

JavaScript library to help modern web applications with accessibility concerns
http://allyjs.io/
MIT License
1.53k stars 82 forks source link

Feature Request(?): Ability to run the browser support tests explicitly #170

Open pudgeball opened 5 years ago

pudgeball commented 5 years ago

Hey there! 👋

I was wondering if it was possible to expose a way to run the browser support tests explicitly. I have things that trigger off the change of focus and ran down a bug today that was happening because of the browser support tests changing the focus.

I'd love some way to manually and explicitly run the support suite so it can build the localStorage item, and anywhere we use Ally functions they can use that cached version.

Thanks!

rodneyrehm commented 5 years ago

Hey there!

Browser support is evaluated here this function is called internally by any function that requires the supports data. So the tests are executed and cached (in localStorage) by the first ally method you use on an origin.

To kick off the tests manually you could do something like ally.element.disabled(document.body) at a time that suits you (before any other ally method is used).

pudgeball commented 5 years ago

That's pretty well what I did, I just wanted to make it more explicit in some way. So it was clear why I was running an ally function at app start-up. At the moment it's just wrapped in a runAllySupportTests function wrapper to try and make it clear.

rodneyrehm commented 5 years ago

ok, so, basically you'd like to expose src/supports/supports (maybe as initialize()) via src/ally to make things more explicit.

pudgeball commented 5 years ago

That would be ideal I think, just so it's clear what's going on. That and I'm calling a function to throw away the result right now which works but just seems silly.