assets/unpoly/unpoly.js in unpoly-rails-3.9.2.1 vs assets/unpoly/unpoly.js in unpoly-rails-3.9.3
- old
+ new
@@ -3,11 +3,11 @@
/* 0 */,
/* 1 */
/***/ (() => {
window.up = {
- version: '3.9.2'
+ version: '3.9.3'
};
/***/ }),
/* 2 */
@@ -4662,10 +4662,11 @@
'backdropOpenAnimation',
'backdropCloseAnimation',
'dismissable',
'dismissLabel',
'dismissAriaLabel',
+ 'trapFocus',
'onOpened',
'onAccept',
'onAccepted',
'onDismiss',
'onDismissed',
@@ -5568,37 +5569,42 @@
const u = up.util;
up.OverlayFocus = class OverlayFocus {
constructor(layer) {
this._layer = layer;
this._focusElement = this._layer.getFocusElement();
+ this._trapFocus = this._layer.trapFocus;
}
moveToFront() {
- if (this._enabled) {
+ if (this._active) {
return;
}
- this._enabled = true;
- this._untrapFocus = up.on('focusin', event => this._onFocus(event));
+ this._active = true;
this._unsetAttrs = e.setTemporaryAttrs(this._focusElement, {
'tabindex': '0',
'role': 'dialog',
- 'aria-modal': 'true'
+ 'aria-modal': this._trapFocus.toString()
});
- this._focusTrapBefore = e.affix(this._focusElement, 'beforebegin', 'up-focus-trap[tabindex=0]');
- this._focusTrapAfter = e.affix(this._focusElement, 'afterend', 'up-focus-trap[tabindex=0]');
+ if (this._trapFocus) {
+ this._untrapFocus = up.on('focusin', event => this._onFocus(event));
+ this._focusTrapBefore = e.affix(this._focusElement, 'beforebegin', 'up-focus-trap[tabindex=0]');
+ this._focusTrapAfter = e.affix(this._focusElement, 'afterend', 'up-focus-trap[tabindex=0]');
+ }
}
moveToBack() {
this.teardown();
}
teardown() {
- if (!this._enabled) {
+ if (!this._active) {
return;
}
- this._enabled = false;
- this._untrapFocus();
+ this._active = false;
this._unsetAttrs();
- this._focusTrapBefore.remove();
- this._focusTrapAfter.remove();
+ if (this._trapFocus) {
+ this._untrapFocus();
+ this._focusTrapBefore.remove();
+ this._focusTrapAfter.remove();
+ }
}
_onFocus(event) {
const { target } = event;
if (this._processingFocusEvent || up.layer.isWithinForeignOverlay(target)) {
return;
@@ -6047,11 +6053,10 @@
return {
preprocess,
finalize,
assertContentGiven,
deriveFailOptions,
- lookupLayers: rememberOriginLayer,
};
})();
/***/ }),
@@ -6569,16 +6574,16 @@
expire(condition = true, testerOptions) {
this._eachMatch(condition, testerOptions, (request) => request.expired = true);
}
reindex(request) {
this._delete(request);
+ delete request.cacheRoute;
this.put(request);
}
_delete(request) {
u.remove(this._requests, request);
request.cacheRoute?.delete(request);
- delete request.cacheRoute;
}
_getRoute(request) {
return request.cacheRoute || (this._routes[request.description] ||= new Route());
}
_isUsable(request) {
@@ -9545,11 +9550,12 @@
openAnimation: 'fade-in',
closeAnimation: 'fade-out',
dismissLabel: '×',
dismissAriaLabel: 'Dismiss dialog',
dismissable: true,
- history: 'auto'
+ history: 'auto',
+ trapFocus: true,
},
cover: {
mainTargets: ['[up-main~=cover]']
},
drawer: {
@@ -9578,10 +9584,11 @@
popup: {
mainTargets: ['[up-main~=popup]'],
position: 'bottom',
size: 'medium',
align: 'left',
- dismissable: 'outside key'
+ dismissable: 'outside key',
+ trapFocus: false,
},
foreignOverlaySelectors: ['dialog']
};
for (let Class of LAYER_CLASSES) {
newConfig[Class.mode].Class = Class;
\ No newline at end of file