Source
1280
1280
* Please note that click event is also triggered by hitting spacebar on the keyboard,
1281
1281
* in which case the number of mouse clicks (stored in event.originalEvent.detail) will be zero.
1282
1282
*/
1283
1283
of: (['click', 'mouseup', 'mousedown'].includes(event.type) && event.originalEvent.detail)
1284
1284
? event
1285
1285
: event.target,
1286
1286
my: 'left top',
1287
1287
at: 'left bottom',
1288
1288
using: (pos, data) => {
1289
1289
const menu = data.element.element[0];
1290
-
const margin_right = Math.max(WRAPPER_PADDING_RIGHT,wrapper_rect.width - $wrapper.outerWidth());
1290
+
const margin_right = Math.max(WRAPPER_PADDING_RIGHT,
1291
+
wrapper_rect.width - $wrapper.outerWidth()
1292
+
);
1291
1293
const max_left = wrapper_rect.right - margin_right - menu.offsetWidth;
1292
1294
1293
1295
pos.left = Math.max(wrapper_rect.left, Math.min(max_left, pos.left));
1294
1296
1295
1297
menu.style.left = `${pos.left}px`;
1296
1298
menu.style.top = `${pos.top}px`;
1297
1299
}
1298
1300
}
1299
1301
}, defaultOptions, options || {});
1300
1302
1457
1459
$submenu_child.prev('[role="menuitem"]')
1458
1460
.removeClass('highlighted')
1459
1461
.attr({'aria-expanded': 'false'});
1460
1462
1461
1463
$submenu_child.css({'display': 'none'});
1462
1464
}
1463
1465
}
1464
1466
}
1465
1467
else {
1466
1468
// Remove activity from item that has been selected by keyboard and now is deselected using mouse.
1467
-
if ($('>a', item[0]).hasClass('highlighted')) {
1468
-
$('>a', item[0])
1469
+
if ($('> a', item[0]).hasClass('highlighted')) {
1470
+
$('> a', item[0])
1469
1471
.removeClass('highlighted')
1470
1472
.blur();
1471
1473
}
1472
1474
1473
1475
// Closes all other submenus from this level, if they were open.
1474
1476
const $submenu = $('ul', item[0]);
1475
1477
1476
1478
if ($submenu.is(':visible')) {
1477
1479
$submenu.prev('[role="menuitem"]')
1478
1480
.removeClass('highlighted')