This text represents something (like a form or a widget) that can't be used until a thing has stopped loading or processing or thinking or kvetching.

Many "loading" animations point out how few elements they use. What they don't note is whether or not they are accessible, nor how to implement them to be accessible.

In this case, the animation is nothing more than a background image animated via keyframes (because I already had it written) which only appears when the containing element has aria-busy set to true .

That means that all your script has to do to enable or disable the loading animation is flip that value and you are already more accessible than not.

You can substitute your favorite loading animation in the main[aria-busy=true]::before part of the CSS (depending how you coded it). You can also change what element you want to use as the parent (perhaps body ?).

As this is a proof of concept, I have the "waiting" animation stay on for a couple seconds then off for four seconds. You may adjust it in the functions in the JS pane. Better JS is always welcome.

See the ARIA spec for more on aria-busy (opens in a new window).

Update : This pen was written in 2015. Read this May 2018 post, Short note on being busy , for more information on the proper use of aria-busy