kylewetton / image-compare-viewer

Compare before and after images, for grading and other retouching for instance. Vanilla JS, zero dependencies.
https://image-compare-viewer.netlify.com
MIT License
553 stars 34 forks source link

Add accessibility/keyboard #62

Open rastapopougros opened 8 months ago

rastapopougros commented 8 months ago

More accessibility is always better. :) Maybe some aria attributes would be relevant, but at first the component have to be used with keyboard (focus inside then arrow keys), not only mouse.

For example, this lib, which has waaay less options than yours (and not maintained), implement this behavior : https://github.com/pehaa/beerslider

There is an input "range" with aria attributes, for accessibility and… that's all, I think there is 0 line of JS for keys because "range" HTML component is already focusable and usable by keyboard! https://developer.mozilla.org/fr/docs/Web/HTML/Element/input/range So I suppose that they only synchronize the bar&after with the percent value of the input "range".