Closed (fixed)
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Sep 2019 at 08:46 UTC
Updated:
16 Sep 2021 at 11:43 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
devicious commentedComment #3
devicious commentedComment #4
huzookaComment #5
huzookaRe:
This issue happens because Paragraphs has to 'mimic' dropbutton output. It has to do that because their classic widget operates with
<input type="submit"/>elements, and not with Link render elements (that's what the Dropbutton was designed).Hard-coded markup in Paragraphs:
Sadly, Views UI does the same here.
Right now, we have issues with these kind of cases since the modules already hardcoded the same (needed) markup that is shipped by stable / Classy / Seven (pick one) because Dropbutton cannot properly render items that aren't links.
Since the implemented design needs the markup changes that we have in our codebase right now, the best that we can do right now is pushing and fixing #3057577: Provide a way to add Buttons to Dropbutton.
Workarounds
I'd suggest using the Experimental widget, but for first we should ask them about why is / was this needed (that breaks the add item element).
So for now:
Could you please confirm that the above works?
Comment #6
devicious commentedHello @huzooka,
Thanks for the quick response.
I've followed your advice and the issue is somewhat mitigated.
Unfortunately this mitigation has its limits as you cannot avoid the broken widget everywhere.
You will need to use it if you decide to show collapsed content to allow paragraph sorting for instance, which is a must have feature.
Moreover remove operation cannot be selected in this case.
Please have a look at the latest screen for details.
Best,
Comment #7
lbesenyei commentedHi, I have made a patch that resolves this issue with the current 'mimiced' dropbutton markup.
I hope it will work for you too fisk.
Comment #8
huzookaComment #9
devicious commented@lbesenyei That was perfect! Thank you
Comment #10
brightbold@lbesenyei's patch in #7 improves Views UI soooo much. Compare the before and after shots.
However, there's a problem with the non-dropdown buttons after the patch — there's a blank space left where the dropdown icon would normally be.
It looks like the "dropbutton--multiple" class is getting applied regardless of whether the "dropbutton--single" class is already there, so I think that's why this is occurring.
Also, is the thing that happens to the active tab in the before shot, where the view display button expands to full width, related to this? It's triggered by the same actions that make the dropbutton go beserk. If it's separate, is it a known issue, or should I file a new one?
Comment #11
saschaeggiComment #12
saschaeggiComment #13
lauriii#10 is related to #3067085: Views top dropbutton breaks when editing a view.
Comment #14
mlncn commentedIt is a great improvement! Not even noticing the whitespace.
Comment #15
huzookaComment #16
shashikant_chauhan commentedJust rerolled the patch from #7
Comment #17
huzookaThe patch in #16 changed the post-processed CSS file, but not the source.
Comment #18
rensingh99 commentedHi,
I have changed post-processed CSS file as well as source file.
Thanks,
Ren
Comment #19
ant1I believe we are working with the wrong patch here.
Patch #18 is for issue #3083048: Provide a tabledrag-handle that is visible in Windows high-contrast mode.
Comment #20
rensingh99 commentedYes you are right. I am removing the patch #18.
Comment #21
rensingh99 commentedI have re rolled for #7
Comment #23
rensingh99 commentedI had missed to add
use Drupal\Core\Render\Markup;
Comment #24
rensingh99 commentedComment #25
lauriiiI don't think we can come with a sufficient solution in Claro. Using regexp to modify already rendered markup seems like the last resort. Moving to the Paragraphs queue since that's the root cause.
Comment #26
saschaeggiI think it should use the extrasmall variant in the future (analog to /admin/content)
example markup for extrasmall dropbutton
Comment #27
seiplax commentedSame type of problem if you have set Paragraphs to use the modal when selecting what type of Paragraph to add.
Settings needed to repeat (in Form display mode settings for the content type the Paragraph is added to):

And if you in the same settings use "Add mode: Dropdown button" you get:
Comment #28
LauraRocksSo I needed to do a fix for our current project (customer has seen the Claro admin and there is no turning back) so I did this patch. I don't know if passes any tests, but it is only adding the needed "dropdown__item" classes to the li-tags (not the toggle one, so it wont disappear) and the "dropdown--multiple". Looks quite ok to me. Made the patch with 8.x-1.x-dev but it should work with current stable version also (minor offset only). Can somebody look through it? I don't know the paragraphs module insides very well, but I just looked at the conversation here and the patch that was originally made for Claro.
Comment #29
LauraRocksHere is paragraphs admin UI without patch

And here is with patch (classes added)

Comment #30
lauriiiThis seems like a pragmatic solution to the problem. I would recommend taking the approach proposed in #28 to temporarily solve this problem (I'm not a maintainer of this project so, in the end, it will be up to them to decide). We're working on #1899236: Add new Splitbutton render element to eventually replace Dropbutton to try to come up with a new splitbutton component that would also support adding buttons to the element.
I'm wondering if we should try to make sure this change gets applied to all usages of dropbuttons in Paragraphs? I tested this manually and I found some use cases that this doesn't solve:
This is the add paragraph button on the classic widget:

This is the add paragraph button on the experimental widget:

We should also manually test this in Seven to ensure there are no regressions.
Comment #31
sasanikolic commentedThanks for all the work on this and useful points!
I agree this solution that @LauraRocks started is the easiest and worked on top of it to fix also the classic widget. The dropdown was also a bit broken because of the (stale?) css definition for style: static. I removed that and double checked, works fine in seven theme. I'm guessing that style was already removed from core and the "fix" is not needed anymore, as the comment pointed above it mentions.
Comment #32
LauraRocksAs @lauriii pointed out, this doesn't fix the " add paragraph button" when using dropbutton, because that code is not here in paragraphs, but it is done in buildDropbutton function in ParagraphsWidget.php somewhere around here i think:
I don't know how fix that. For now, the Paragraphs & Claro is usable with the patch in #28 and NOT using the add mode "Dropdown button" OR the experimental widget. Would be nice to fix all them but I can't at the moment.
EDIT: I was to slow, yes the patch in #31 fixes the dropdown button also!
Comment #33
sasanikolic commented@LauraRocks can you check again with my patch (#31) applied, please? It seems to work fine for me on the Dropdown button.
Comment #34
LauraRocksYes, just edited my answer, I was too slow with answering, didn't check your answer, looks good now!
Comment #35
sasanikolic commentedGreat! We still want to make all buttons smaller in order to be consistent and have the view more compact for pages with many paragraphs. Will work on it now.
Comment #36
lauriii+1 to #35! I was thinking of opening follow-up for that but I'm happy if it gets done here 👍
Comment #37
sasanikolic commentedHere is a bit of an improved version with "extrasmall" buttons. Our idea was to have the buttons on the right side "extrasmall" and the dropdown selection at the bottom "small", to have a bit of a separation between the importance of the buttons, but there is
claro_preprocess_links__dropbutton__operations()which sets all dropdown operations to "extrasmall", so I don't think we should/can alter that?There is also another issue that I noticed with the text next to the dropdown paragraphs selection - the spaces in the text don't work anymore. Let's create a followup for that.
Comment #38
chandeepkhosa commentedThanks for the work here, I can also confirm that the patch in #37 fixes this issue in Claro & doesn't have any regressions in Seven too.
I didn't experience the problem as described in the title or issue summary as I guess this has been fixed in newer versions since it was raised in September.
I did however experience the problem in the screenshots of #30 and was looking to fix that. I'd like to propose that the issue title is renamed to something along the lines of 'Add paragraph button dropdown bug in Claro' so that others experiencing the problem can more easily find this issue. What do you think?
Comment #39
sasanikolic commentedLet's try to push this topic forward. Anyone can test properly? :)
Comment #40
miro_dietikerComment #41
saschaeggiI've just tested this with the patch from #37 and for me it works with Drupal 8.8.2 against Paragraphs 1.10.x
Comment #42
saschaeggiUpdated the patch from #37 to include the fix for the text label "to xxx" which is also open according to #3108997: [META] Claro theme UI improvements
Patch attached. (Patch worked against 8.x-1.10 but needs to be re-rolled against dev).
Comment #43
miro_dietikerI'm sorry, It seems i accidentally committed #37 here after my review in #3103995-6: Improve visual coherence in Claro in combination with Field group horizontal tabs .
Please consider accordingly. It's a bit late to revert, but i didn't even review the code here, i just test drove them. :-7
This needs a full review and likely improvements to close.
Comment #44
sasanikolic commentedRerorlled @saschaeggi's #42 patch to 8.x.1.x.
I also removed the stale negative margins around the "add paragraphs" button. Tested also in seven and didn't see any real use of them. They were breaking the display in Claro as they were hardcoded values.
Attaching the before/after screenshots.
Comment #45
saschaeggi@sasanikolic tested on Seven & Claro, does work great.
Claro:

Seven:

I've added one visual improvement to the patch from #44.
Before:

After:

Comment #47
berdirThanks everyone, if @saschaeggi says this is ready then I'm happy to believe that :)
Lots of people contributed here, thanks everyone.
Comment #49
Jonny Gong commentedI rerorlled a patch based on #7 @lbesenyei and it works for me !
paragraph: 8.x-1.x
PHP: 7.3
Core: 8.8.x
Comment #50
eduardo morales albertiI need to apply the #49 patch.
Comment #51
eduardo morales albertiAfter update paragraph dev, to last version (dev-1.x 203ecf8)
Before apply patch #49:


After apply patch #49: