From 0bb61f30f76ae73614f37b57c9f0eb09bb42693d Mon Sep 17 00:00:00 2001 From: Dominik Pesch Date: Mon, 25 Apr 2016 09:04:53 +0200 Subject: [PATCH 1/4] patched the "Focus Examination Function" to bypass events for elements in parents with .blockMsgClass jQuery UI Datepicker creates its calendar at the end of the document (mostly outside an active modal jqm dialog) which disallows to change the year (select) in a modal jqm. The solution was found in and adopted for jqModal. This allows two solutions: 1. add `blockMsg` css class to the datepicker div 2. or set the (new) jqm option `blockMsgClass` to '`ui-datepicker`' Both settings allow the focus event for the year select to bypass the "Focus Examination Function". --- CHANGELOG.md | 3 +++ jqModal.js | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab77c4f..c3edaa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ jqModal Changes By Release ========================== +## 1.4.2 (2016.04.24 +r27.1) +* allow exclusions for elements which are children of .blockMsg + ## 1.4.2 (2016.04.16 +r27) * restore parsing and assigning closeClass behavior in ajax loaded content diff --git a/jqModal.js b/jqModal.js index a3ed417..1557cb9 100644 --- a/jqModal.js +++ b/jqModal.js @@ -6,7 +6,7 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * $Version: 1.4.2 (2016.04.16 +r27) + * $Version: 1.4.2 (2016.04.16 +r27a, patched) * Requires: jQuery 1.2.3+ */ @@ -318,9 +318,16 @@ }, X = function(e){ // X: The Focus Examination Function (for modal: true dialogs) - var targetModal = $(e.target).data('jqm') || - $(e.target).parents('.jqm-init:first').data('jqm'); - var activeModal = ActiveModals[ActiveModals.length-1]; + var $target = $(e.target), + targetModal = $target.data('jqm') || + $.target.parents('.jqm-init:first').data('jqm'); + var activeModal = ActiveModals[ActiveModals.length-1], + activeModalOpts = $(activeModal).data('jqm'); + + // allow all elements with parents.blockMsgClass (used for jqui datepicker) + if ($target.parents('.'+activeModalOpts.blockMsgClass).length > 0) { + return true; + } // allow bubbling if event target is within active modal dialog return (targetModal && targetModal.ID === activeModal._jqmID) ? @@ -356,6 +363,7 @@ * (Function) onShow - User defined callback function fired when modal opened. * (Function) onHide - User defined callback function fired when modal closed. * (Function) onLoad - User defined callback function fired when ajax content loads. + * (String) blockMsgClass- User defined exclusion parent class which are allowed to get focus even outside the active modal */ params: { overlay: 50, @@ -370,7 +378,8 @@ toTop: false, onShow: onShow, onHide: onHide, - onLoad: false + onLoad: false, + blockMsgClass: 'blockMsg' }, // focusFunc is fired: From 5c8f4ee39be70c6ea42f4e21722e1c5f0642cff2 Mon Sep 17 00:00:00 2001 From: Dominik Pesch Date: Mon, 25 Apr 2016 09:28:31 +0200 Subject: [PATCH 2/4] added the jQuery UI Datepicker example to the blockMsgClass comment --- jqModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqModal.js b/jqModal.js index 1557cb9..3672404 100644 --- a/jqModal.js +++ b/jqModal.js @@ -363,7 +363,7 @@ * (Function) onShow - User defined callback function fired when modal opened. * (Function) onHide - User defined callback function fired when modal closed. * (Function) onLoad - User defined callback function fired when ajax content loads. - * (String) blockMsgClass- User defined exclusion parent class which are allowed to get focus even outside the active modal + * (String) blockMsgClass- User defined exclusion parent class which are allowed to get focus even outside the active modal (like the jQueryUI datepicker) */ params: { overlay: 50, From 29b23d5c511b43af534e991b796e024950afc6cc Mon Sep 17 00:00:00 2001 From: Dominik Pesch Date: Tue, 26 Apr 2016 16:07:14 +0200 Subject: [PATCH 3/4] fixed: typo ($.target instead of $target) --- jqModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqModal.js b/jqModal.js index 3672404..b6dd061 100644 --- a/jqModal.js +++ b/jqModal.js @@ -320,7 +320,7 @@ var $target = $(e.target), targetModal = $target.data('jqm') || - $.target.parents('.jqm-init:first').data('jqm'); + $target.parents('.jqm-init:first').data('jqm'); var activeModal = ActiveModals[ActiveModals.length-1], activeModalOpts = $(activeModal).data('jqm'); From 9d22cd1d0779e67c01c6ee7afe2a6c833f174da2 Mon Sep 17 00:00:00 2001 From: Dominik Pesch Date: Wed, 3 Jun 2020 13:26:42 +0200 Subject: [PATCH 4/4] Ignore Jetbrains ide + package.lock --- .gitignore | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 88694d4..dbd2f84 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ /.classpath /.buildpath /.settings/ +/.idea - - - +# as lib it ignores the package-lock +/package-lock.json