diff --git a/CHANGELOG.md b/CHANGELOG.md index 75eb26f5566..1098bf808eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Craft CMS 3.x +## Unreleased + +### Fixed +- Fixed a bug where `Garnish.setFocusWithin()` wasn’t working if the first focusable element was a checkbox. ([#11498](https://github.com/craftcms/cms/discussions/11498)) + ## 3.7.45.2 - 2022-06-24 ### Fixed diff --git a/src/web/assets/garnish/dist/garnish.js b/src/web/assets/garnish/dist/garnish.js index 1105ecf4813..24282f96cc9 100644 --- a/src/web/assets/garnish/dist/garnish.js +++ b/src/web/assets/garnish/dist/garnish.js @@ -1,3 +1,3 @@ /*! For license information please see garnish.js.LICENSE.txt */ -!function(){var t={55:function(t,e,i){var s=i(132),n=i(820),o=s.default;void 0===n.Garnish&&(n.Garnish=o),t.exports=s},820:function(t,e,i){"use strict";t.exports=function(){if("object"==typeof globalThis)return globalThis;var t;try{t=this||new Function("return this")()}catch(t){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==i.g)return i.g}return t}()},132:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return X}});var s=jQuery,n=i.n(s);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}var h=function(){};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}h.extend=function(t,e){var i=h.prototype.extend;h._prototyping=!0;var s=new this;i.call(s,t),s.base=function(){},delete h._prototyping;var n=s.constructor,o=s.constructor=function(){if(!h._prototyping)if(this._constructing||this.constructor==o)this._constructing=!0,n.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||i).call(arguments[0],s)};return o.ancestor=this,o.extend=this.extend,o.forEach=this.forEach,o.implement=this.implement,o.prototype=s,o.toString=this.toString,o.valueOf=function(t){return"object"==t?o:n.valueOf()},i.call(o,e),"function"==typeof o.init&&o.init(),o},h.prototype={extend:function(t,e){if(arguments.length>1){var i=this[t];if(i&&"function"==typeof e&&(!i.valueOf||i.valueOf()!=e.valueOf())&&/\bbase\b/.test(e)){var s=e.valueOf();e=function(){var t=this.base||h.prototype.base;this.base=i;var e=s.apply(this,arguments);return this.base=t,e},e.valueOf=function(t){return"object"==t?e:s},e.toString=h.toString}this[t]=e}else if(t){var n=h.prototype.extend;h._prototyping||"function"==typeof this||(n=this.extend||n);for(var r={toSource:null},a=["constructor","toString","valueOf"],l=h._prototyping?0:1;d=a[l++];)t[d]!=r[d]&&n.call(this,d,t[d]);for(var d in t)if(!r[d]){var u=Object.getOwnPropertyDescriptor(t,d);"undefined"!=o(u.value)?n.call(this,d,u.value):Object.defineProperty(this,d,u)}}return this}},h=h.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(t,e,i){for(var s in t)void 0===this.prototype[s]&&e.call(i,t[s],s,t)},implement:function(){for(var t=0;t=0;n--){var o=this._eventHandlers[n];o.type!==s[0]||s[1]&&o.namespace!==s[1]||o.handler!==e||this._eventHandlers.splice(n,1)}},trigger:function(t,e){var i,s,o,h={type:t,target:this};for(i=0;ithis.drag._maxMouseScrollY&&(this.drag._scrollProperty="scrollTop",this.drag._scrollAxis="Y",this.drag._scrollDist=Math.round((this.mouseY-this.drag._maxMouseScrollY)/2)))),this.drag._scrollProperty||this.settings.axis===F.Y_AXIS||(this.drag._winScrollLeft=F.$win.scrollLeft(),this.drag._minMouseScrollX=this.drag._winScrollLeft+F.BaseDrag.windowScrollTargetSize,this.mouseXthis.drag._maxMouseScrollX&&(this.drag._scrollProperty="scrollLeft",this.drag._scrollAxis="X",this.drag._scrollDist=Math.round((this.mouseX-this.drag._maxMouseScrollX)/2)))),this.drag._scrollProperty?(this.scrollProperty||(this.scrollProxy||(this.scrollProxy=this._scrollWindow.bind(this)),this.scrollFrame&&(F.cancelAnimationFrame(this.scrollFrame),this.scrollFrame=null),this.scrollFrame=F.requestAnimationFrame(this.scrollProxy)),this.scrollProperty=this.drag._scrollProperty,this.scrollAxis=this.drag._scrollAxis,this.scrollDist=this.drag._scrollDist):this._cancelWindowScroll()),this.onDrag()},stopDragging:function(){this.dragging=!1,this.onDragStop(),this._cancelWindowScroll()},addItems:function(t){t=n().makeArray(t);for(var e=0;e=F.BaseDrag.minMouseDist&&this.startDragging()),this.dragging&&this.drag(!0)},_handleMouseUp:function(t){this.removeAllListeners(F.$doc),this.dragging&&this.stopDragging(),this.$targetItem=null},_scrollWindow:function(){this._.scrollPos=F.$scrollContainer[this.scrollProperty](),F.$scrollContainer[this.scrollProperty](this._.scrollPos+this.scrollDist),this["mouse"+this.scrollAxis]-=this._.scrollPos-F.$scrollContainer[this.scrollProperty](),this["realMouse"+this.scrollAxis]=this["mouse"+this.scrollAxis],this.drag(),this.scrollFrame=F.requestAnimationFrame(this.scrollProxy)},_cancelWindowScroll:function(){this.scrollFrame&&(F.cancelAnimationFrame(this.scrollFrame),this.scrollFrame=null),this.scrollProperty=null,this.scrollAxis=null,this.scrollDist=null},_deinitItem:function(t){this.removeAllListeners(t),n().removeData(t,"drag")}},{minMouseDist:1,windowScrollTargetSize:25,defaults:{handle:null,axis:null,ignoreHandleSelector:"input, textarea, button, select, .btn",onDragStart:n().noop,onDrag:n().noop,onDragStop:n().noop}}),u=a.extend({$container:null,$all:null,$options:null,init:function(t){this.$container=n()(t),this.$container.data("checkboxSelect")&&(console.warn("Double-instantiating a checkbox select on an element"),this.$container.data("checkboxSelect").destroy()),this.$container.data("checkboxSelect",this);var e=this.$container.find("input");this.$all=e.filter(".all:first"),this.$options=e.not(this.$all),this.addListener(this.$all,"change","onAllChange")},onAllChange:function(){var t=this.$all.prop("checked");this.$options.prop({checked:t,disabled:t})},destroy:function(){this.$container.removeData("checkboxSelect"),this.base()}}),g=a.extend({$target:null,options:null,$menu:null,showingMenu:!1,init:function(t,e,i){this.$target=n()(t),this.$target.data("contextmenu")&&(console.warn("Double-instantiating a context menu on an element"),this.$target.data("contextmenu").destroy()),this.$target.data("contextmenu",this),this.options=e,this.setSettings(i,F.ContextMenu.defaults),F.ContextMenu.counter++,this.enable()},buildMenu:function(){this.$menu=n()('