From 8bdda48a01a9096f0b7fc1a63fcabc63bef16a26 Mon Sep 17 00:00:00 2001 From: Matt Elkins Date: Thu, 18 Jul 2024 07:44:30 +0100 Subject: [PATCH 1/5] Add radio class to container. --- layouts/joomla/form/field/radio/switcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/joomla/form/field/radio/switcher.php b/layouts/joomla/form/field/radio/switcher.php index 191a5a07850a1..746e7936bc771 100644 --- a/layouts/joomla/form/field/radio/switcher.php +++ b/layouts/joomla/form/field/radio/switcher.php @@ -71,7 +71,7 @@ -
+
$option) : ?> Date: Thu, 18 Jul 2024 08:11:57 +0100 Subject: [PATCH 2/5] Revert "Add radio class to container." This reverts commit 8bdda48a01a9096f0b7fc1a63fcabc63bef16a26. --- layouts/joomla/form/field/radio/switcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/joomla/form/field/radio/switcher.php b/layouts/joomla/form/field/radio/switcher.php index 746e7936bc771..191a5a07850a1 100644 --- a/layouts/joomla/form/field/radio/switcher.php +++ b/layouts/joomla/form/field/radio/switcher.php @@ -71,7 +71,7 @@ -
+
$option) : ?> Date: Thu, 18 Jul 2024 08:28:30 +0100 Subject: [PATCH 3/5] Look for .switcher if .radio is falsy. --- .../system/js/fields/joomla-field-subform.w-c.es6.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js index 305b0d7c7165f..26c7e7b2ec124 100644 --- a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js @@ -313,8 +313,8 @@ class JoomlaFieldSubform extends HTMLElement { // Set the id for fieldset and group label if (!countMulti) { - // Look for
or
- let fieldset = $el.closest('.radio'); + // Look for
or
or
+ let fieldset = $el.closest('.radio') ?? $el.closest('.switcher'); // eslint-disable-next-line no-nested-ternary fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false); From 8924b6c4b3fac31ea460fcd4931bb5abe8611749 Mon Sep 17 00:00:00 2001 From: Matt Elkins Date: Thu, 18 Jul 2024 08:31:45 +0100 Subject: [PATCH 4/5] Fix comment line length with Airbnb multiline. --- .../system/js/fields/joomla-field-subform.w-c.es6.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js index 26c7e7b2ec124..4781d02c53fba 100644 --- a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js @@ -313,7 +313,12 @@ class JoomlaFieldSubform extends HTMLElement { // Set the id for fieldset and group label if (!countMulti) { - // Look for
or
or
+ /** + * Look for one of: + * -
+ * -
+ * -
+ */ let fieldset = $el.closest('.radio') ?? $el.closest('.switcher'); // eslint-disable-next-line no-nested-ternary fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false); From c2802cf41f51c966d3274a1e25cb651d25ed52da Mon Sep 17 00:00:00 2001 From: Matt Elkins Date: Thu, 18 Jul 2024 11:05:59 +0100 Subject: [PATCH 5/5] Look for closest fieldset element should a container with one of the specified classes not exist. --- .../js/fields/joomla-field-subform.w-c.es6.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js index 4781d02c53fba..41d7defebcc8a 100644 --- a/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-subform.w-c.es6.js @@ -287,9 +287,12 @@ class JoomlaFieldSubform extends HTMLElement { // Set the id for fieldset and group label if (!countMulti) { // Look for
or
- let fieldset = $el.closest('.checkboxes'); + let fieldset = $el.closest('.checkboxes, fieldset'); // eslint-disable-next-line no-nested-ternary - fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false); + if (fieldset) { + // eslint-disable-next-line no-nested-ternary + fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false); + } if (fieldset) { const oldSetId = fieldset.id; @@ -319,9 +322,11 @@ class JoomlaFieldSubform extends HTMLElement { * -
* -
*/ - let fieldset = $el.closest('.radio') ?? $el.closest('.switcher'); - // eslint-disable-next-line no-nested-ternary - fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false); + let fieldset = $el.closest('.radio, .switcher, fieldset'); + if (fieldset) { + // eslint-disable-next-line no-nested-ternary + fieldset = fieldset.nodeName === 'FIELDSET' ? fieldset : (fieldset.parentElement.nodeName === 'FIELDSET' ? fieldset.parentElement : false); + } if (fieldset) { const oldSetId = fieldset.id;