
Problem/Motivation
Additional slot row disappears after value change when used in nested paragraphs (paragraph in another paragraph type)
D10, admin theme Gin
Steps to reproduce
Create a paragraph structure like:
1. Component (paragraph type)
-- Some field set one (nested paragraph type)
-- -- Office hours
-- -- [other fields]
-- [other field sets
2. Click "Add time slot"
3. Change any (time) value in the new slot
4. The row will disappear (the value is still there, just visually removed)
Proposed resolution
Adjusted js file to account for script re-initiations due to paragaph changes
Remaining tasks
Test
Comment | File | Size | Author |
---|---|---|---|
#3 | office_hours-3451875-7_once_hide.patch | 2.48 KB | johnv |
fix-multiple-slots.patch | 2.6 KB | max.valetov |
Comments
Comment #2
johnvI have some questions about your patch.
- the patch is not against latest version, with for example part of #3449164: Refactor the JavaScript for the widget to use the once library in it. That is not a problem however to evaluate your patch. But it does already introduce some more focussing.
- you have a problem in a specific paragraphs constellation. I presume you have no problem in a less complex layout? (there were some issues with paragraphs before)
- in the first 2 parts, I guess the addClass/removeClass is the part that truely fixes your problem?
- in the first 2 parts you change the UX: removing the cleared row and adding the 'Add' link of the previous row. I guess that is not part of your problem, but an additional feature? Indeed , current behaviour is more like 'clear', then 'remove'. But I feel removing the clicked-upon row is confusing.
- in the last 2 parts, why do you switch from 'id' to 'data-drupal-selector'? Is that best practice? If so, I can change it, but it gives no technical/functional improvement, does it?
Additionally, please check the introduction of once in #3449164-11: Refactor the JavaScript for the widget to use the once library, if it will not break your use case.
I need some confirmation on the proposed change there.
Comment #3
johnvPlease find the remainder of your original patch, for the hide and once features.
Comment #4
johnvComment #5
andreasderijckeThis does occur in other nested situations too, when using field_group (for example) to put the field in:
- details element
- tabs
- ...
Tested on the last DEV commit at moment of writing.
Will try to update the patch (or have a colleague do it), as it doesn't apply on the last DEV commit.
Comment #6
johnvThanks @andreasderijcke.
Please note that I just released a new version.
Please also take into account the open ticket #3449164: Refactor the JavaScript for the widget to use the once library
Comment #7
andreasderijckeComment #8
andreasderijckeGetting #3449164: Refactor the JavaScript for the widget to use the once library fixed first might make fixing this easier, if only to avoid a merge hell.
Comment #9
andreasderijcke#3449164: Refactor the JavaScript for the widget to use the once library fixes this problem as far as I could reproduce and test it.
@max.valetov Can you check if this is the case for you too?
Comment #10
johnvThanks, the remainder is indeed fixed in #3449164: Refactor the JavaScript for the widget to use the once library
Comment #12
johnvComment #13
johnvComment #14
andreasderijcke