bumbu/svg-pan-zoom

Add keyboard accessibility to zoom controls

Open

#347 创建于 2019年8月19日

在 GitHub 查看
 (1 评论) (3 反应) (0 负责人)JavaScript (1,585 star) (383 fork)batch import
enhancementfeature requesthelp wanted

描述

Currently, the zoom feature in this library appears to only be usable by mouse or touchpad devices.

Because the element generating the zoom in/zoom out icons are not inherently keyboard accessible, this means someone that cannot use a mouse or touchpad successfully cannot zoom in on the SVG, which could be a map or similar content. This functionality is crucial for accessibility. https://www.w3.org/TR/WCAG21/#keyboard-accessible

I would recommend adding keyboard event listeners wherever click/touchstart events are. Keyboard event listeners can look for whether the Enter or Space key is entered, and on keypress, zoom in or out accordingly depending on which button the keyboard pressed.

Additionally, the user should be able to use the arrow keys to navigate throughout the SVG and focus on certain areas, similar to the way a mouse user can drag the SVG to focus on certain areas.

This shouldn't take away from any other features, and only add more accessibility to the library.

贡献者指南