Skip to content

Commit cd9a556

Browse files
committed
Fix: Force body focus (fixes #626)
1 parent 230a2fa commit cd9a556

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

js/a11y.js

+6
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,12 @@ class A11y extends Backbone.Controller {
730730
focusFirst($element, options) {
731731
options = new FocusOptions(options);
732732
$element = $($element).first();
733+
const isBodyFocus = ($element[0] === document.body);
734+
if (isBodyFocus) {
735+
// force focus to the body, effectively starting the tab cursor from the top
736+
this.focus($element, options);
737+
return;
738+
}
733739
if (this.isReadable($element)) {
734740
this.focus($element, options);
735741
return $element;

0 commit comments

Comments
 (0)