MENU

Fun & Interesting

Bricks Builder: Focus Trap for improved accessibility

WP Easy 328 lượt xem 1 month ago
Video Not Working? Fix It Now

Hey all. This is just some JavaScript code to create a generic "Focus Trap" which can be used on Element structures for improved accessibility.

Basically, when a set of focusable items has this "Focus Trap" and one of the focusable elements gets focus, the keys "ArrowUp", "ArrowDown", "Home" and "End" navigate thought the items. There is also an option to auto click the items when they get focus.

GIST: https://gist.github.com/wpeasy/c6ff9c4fe811160b7fad9b9061f6c687

Comment