modxcms / a11y

MODX Accessibility for the Manager
13 stars 10 forks source link

Clear Cache #14

Open dubrod opened 9 years ago

dubrod commented 9 years ago

When I focus "Manage" with mouse, and down arrow to "Clear Cache" , hit enter you don't know whats happening.

Can we create a Keyboard shortcut to Clear Cache?

paulbohman commented 9 years ago

First of all, there is already a keyboard shortcut for clearing cache, which I discovered by accident. On a Mac it is command + shift + U. I don't know if you guys put it in there or purpose or not, but don't take it out!

Fixing the keyboard accessibility and focus issues with the modal is one part of this. The other part is to take advantage of aria-live regions to make announcements. The full console message on clear cache is probably too wordy to force screen readers to read it all, but you could run the console, then output a success/error message to an aria-live region. The aria-live region is just a container on the page:

<div aria-live="polite" aria-atomic="true"></div>

This container MUST be in the DOM on page load, or it probably won't work.

Then when the console finishes, you use JavaScript to inject the message into the live region:

<div aria-live="polite" aria-atomic="true">Cache cleared successfully. <a href="#console-stream">View console messages above.</a></div>

Something like that would work. (The aria-atomic may or may not be necessary. Test it.)

This will cause the screen reader to announce the message. Actually, for this example, you'd also want to move the keyboard focus to the aria-live announcement, because there's a link in it, which they wouldn't be able to find easily if you don't move the focus there.

dubrod commented 8 years ago

@theboxer when the cache modal pops it creates the .x-window on demand so i think its going to be a core change. unless we can attached a message to the event like Paul said and have the markup above sitting in the DOM waiting.