Skip to content

Commit 29dce70

Browse files
committed
MC-19639: Admin Analytics modal allows user to navigate the admin
1 parent 7e3319e commit 29dce70

File tree

1 file changed

+16
-8
lines changed
  • app/code/Magento/AdminAnalytics/view/adminhtml/web/js/modal

1 file changed

+16
-8
lines changed

app/code/Magento/AdminAnalytics/view/adminhtml/web/js/modal/component.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,31 +130,39 @@ define([
130130
* so the user must select an option to dismiss the modal
131131
*/
132132
handleTabKey: function (event) {
133-
var modal = this;
134-
var KEY_TAB = 9;
133+
var modal = this,
134+
KEY_TAB = 9;
135135

136+
/**
137+
* Handle Shift+Tab to tab backwards
138+
*/
136139
function handleBackwardTab() {
137-
if ( document.activeElement === modal.firstFocusableElement
138-
|| document.activeElement === $(modal.rootSelector)[0]
140+
if (document.activeElement === modal.firstFocusableElement ||
141+
document.activeElement === $(modal.rootSelector)[0]
139142
) {
140143
event.preventDefault();
141144
modal.lastFocusableElement.focus();
142145
}
143146
}
147+
148+
/**
149+
* Handle Tab forward
150+
*/
144151
function handleForwardTab() {
145-
if ( document.activeElement === modal.lastFocusableElement) {
152+
if (document.activeElement === modal.lastFocusableElement) {
146153
event.preventDefault();
147154
modal.firstFocusableElement.focus();
148155
}
149156
}
150157

151-
switch(event.keyCode) {
158+
switch (event.keyCode) {
152159
case KEY_TAB:
153-
if ( modal.focusableElements.length === 1 ) {
160+
if (modal.focusableElements.length === 1) {
154161
event.preventDefault();
155162
break;
156163
}
157-
if ( event.shiftKey ) {
164+
165+
if (event.shiftKey) {
158166
handleBackwardTab();
159167
break;
160168
}

0 commit comments

Comments
 (0)