Perfect-scrollbar: Accessibility Support (Using Keyboard)​

Created on 26 Nov 2015  Â·  3Comments  Â·  Source: mdbootstrap/perfect-scrollbar

The changes to add for Accessibility support:
in perfect-scrollbar/src/js/lib/event-manager.js after line 37: i.scrollbarX = d.appendTo(d.e('div', 'ps-scrollbar-x'), i.scrollbarXRail);
we should set tabindex attribute:
i.scrollbarX.setAttribute( 'tabindex', 0)
and after line 53: i.scrollbarY = d.appendTo(d.e('div', 'ps-scrollbar-y'), i.scrollbarYRail);
we should add:
i.scrollbarY.setAttribute( 'tabindex', 0)

This functionality adds the ability to access the scroll via keyboard.

in perfect-scrollbar/src/js/plugin/handler/keyboard.js remove lines 49-51:
if (!hovered) {
return;
}
that cause the keyboard up/down keypress to work only on mousehover
that's all!

Most helpful comment

Is it possible to make it configurable? this behaviour (gaining focus by rail) may be undesirable and should be possible to avoid

All 3 comments

I can use that too. please add

Thanks for the change.

But what about the second change:
in perfect-scrollbar/src/js/plugin/handler/keyboard.js remove lines 49-51:

if (!hovered) {
return;
}

these lines cause the keyboard up/down keypress to work only on mousehover - and the accessibility rule is that when you focus on the scrollbar you can go up and down also not on mousehover.

waiting to your reply.

Is it possible to make it configurable? this behaviour (gaining focus by rail) may be undesirable and should be possible to avoid

Was this page helpful?
0 / 5 - 0 ratings