Hello,
I've found an issue with Claro in the following scenario:

  1. Create a CT with reference to paragraphs
  2. Create a few paragraphs types
  3. Perform the data entry of the CT
  4. The dropodown menu that is supposed to let the user choose the paragraph component to include is broken and prevents save (Button overlaps)

Have a look at the screens for details.
The html class of the broken component is:
dropbutton-wrapper dropbutton-multiple

Severy is set to major due to the inability to save the content.


CommentFileSizeAuthor
#51 nice_selectlist.png55.03 KBeduardo morales alberti
#51 broken_selectlist.png58.65 KBeduardo morales alberti
#49 before_49.png21.6 KBJonny Gong
#49 after_49.png20.93 KBJonny Gong
#49 broken-dropbutton-3079128-49.patch1.08 KBJonny Gong
#45 broken-dropbutton-3079128-45.patch1.87 KBsaschaeggi
#45 dropbutton_claro_after_45.png14.18 KBsaschaeggi
#45 dropbutton_claro_before_45.png13.87 KBsaschaeggi
#45 button_seven_45.png16.65 KBsaschaeggi
#45 button_claro_45.png15.83 KBsaschaeggi
#44 broken-dropbutton-3079128-44-interdiff.txt853 bytessasanikolic
#44 broken-dropbutton-3079128-44.patch1.68 KBsasanikolic
#44 After #44.png196.1 KBsasanikolic
#44 Before #44.png148.71 KBsasanikolic
#42 broken-dropbutton-3079128-42.patch7.79 KBsaschaeggi
#37 broken-dropbutton-3079128-37-interdiff.txt7.01 KBsasanikolic
#37 broken-dropbutton-3079128-37.patch7.29 KBsasanikolic
#37 After patch 37.png157.21 KBsasanikolic
#31 After patch 31 - expanded.png65.75 KBsasanikolic
#31 After patch 31.png19.07 KBsasanikolic
#31 Before patch 31.png18.76 KBsasanikolic
#31 broken-dropbutton-3079128-31-interdiff.txt1.82 KBsasanikolic
#31 broken-dropbutton-3079128-31.patch4.3 KBsasanikolic
#30 Screen Shot 2019-12-18 at 15.54.01.png27.87 KBlauriii
#30 Screen Shot 2019-12-18 at 15.53.43.png50.55 KBlauriii
#29 after_patch.png35.37 KBLauraRocks
#29 before_patch.png41.24 KBLauraRocks
#28 broken-dropbutton-3079128-28.patch2.76 KBLauraRocks
#27 3079128-Add-mode-Dropdown-button.png12.64 KBseiplax
#27 3079128-paragraph-form-display-mode-settings.png63.56 KBseiplax
#27 3079128-add-item-modal-button-description-float-problem.png62.86 KBseiplax
#23 3079128-23.patch1.14 KBrensingh99
#21 3079128-21.patch951 bytesrensingh99
#18 3079128-18.patch4.8 KBrensingh99
#16 broken-dropbutton-3079128_16.patch2.39 KBshashikant_chauhan
#10 claro-views-ui-zoom.png27.18 KBbrightbold
#10 claro-views-ui-after.png291.11 KBbrightbold
#10 claro-views-ui-before.png334.33 KBbrightbold
#7 broken-dropbutton-3079128.patch1.16 KBlbesenyei
#6 Screenshot 2019-09-05 at 16.13.00.png611.61 KBdevicious
#3 Screenshot 2019-09-04 at 10.51.56.png71.57 KBdevicious
Screenshot 2019-09-04 at 10.40.08.png97.04 KBdevicious

Comments

fisk created an issue. See original summary.

devicious’s picture

Issue summary: View changes
devicious’s picture

StatusFileSize
new71.57 KB
huzooka’s picture

Assigned: Unassigned » huzooka
huzooka’s picture

Assigned: huzooka » Unassigned
Related issues: +#3057577: Provide a way to add Buttons to Dropbutton

Re:

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:

  1. Keep using the classic widget.
  2. The operations of a single item cannot be fixed by choosing an another settings, but it still lifts the items on a higher z-index level if you click on the toggle, so based on my understanding it is functional. (Yes, it is terrible, ugly, and I won't show this to a client.)
  3. You have to choose 'Select list' or 'Buttons for the 'Add mode' and not the 'Dropdown button' option.

Could you please confirm that the above works?

devicious’s picture

StatusFileSize
new611.61 KB

Hello @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,

lbesenyei’s picture

StatusFileSize
new1.16 KB

Hi, I have made a patch that resolves this issue with the current 'mimiced' dropbutton markup.

I hope it will work for you too fisk.

huzooka’s picture

Status: Active » Needs review
devicious’s picture

@lbesenyei That was perfect! Thank you

brightbold’s picture

Status: Needs review » Needs work
StatusFileSize
new334.33 KB
new291.11 KB
new27.18 KB

@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.

Screenshot of Views UI Header, Footer, and No Results Behavior sections, where the "Add" button next to the first and last of those has a blank white box whereas in the Add button next to Footer, that space is the same gray as the rest of the button and shows the down arrow icon indicating the dropdown

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?

saschaeggi’s picture

Issue summary: View changes
saschaeggi’s picture

lauriii’s picture

mlncn’s picture

It is a great improvement! Not even noticing the whitespace.

huzooka’s picture

Project: Claro » Drupal core
Version: 8.x-1.0-alpha4 » 8.9.x-dev
Component: Code » Claro theme
Issue tags: +Needs reroll
shashikant_chauhan’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new2.39 KB

Just rerolled the patch from #7

huzooka’s picture

Status: Needs review » Needs work

The patch in #16 changed the post-processed CSS file, but not the source.

rensingh99’s picture

Status: Needs work » Needs review
StatusFileSize
new4.8 KB

Hi,

I have changed post-processed CSS file as well as source file.

Thanks,
Ren

ant1’s picture

Status: Needs review » Needs work

I 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.

rensingh99’s picture

Yes you are right. I am removing the patch #18.

rensingh99’s picture

Status: Needs work » Needs review
StatusFileSize
new951 bytes

I have re rolled for #7

Status: Needs review » Needs work

The last submitted patch, 21: 3079128-21.patch, failed testing. View results

rensingh99’s picture

StatusFileSize
new1.14 KB

I had missed to add

use Drupal\Core\Render\Markup;

rensingh99’s picture

Status: Needs work » Needs review
lauriii’s picture

Project: Drupal core » Paragraphs
Version: 8.9.x-dev » 8.x-1.x-dev
Component: Claro theme » Code
Status: Needs review » Active

I 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.

saschaeggi’s picture

I think it should use the extrasmall variant in the future (analog to /admin/content)

example markup for extrasmall dropbutton

<div class="dropbutton-wrapper dropbutton-multiple">
  <div class="dropbutton-widget">
    <ul class="dropbutton dropbutton--multiple dropbutton--extrasmall">
      <li class="edit dropbutton__item dropbutton__item--extrasmall dropbutton-action">
        <a href="/" hreflang="en">Edit</a>
      </li>
      <li class="dropbutton-toggle">
         <button type="button" class="dropbutton__toggle">
           <span class="visually-hidden">List additional actions</span>
         </button>
      </li>
      <li class="delete dropbutton__item dropbutton__item--extrasmall dropbutton-action secondary-action">
        <a href="/" hreflang="en">Delete</a>
      </li>
      <li class="devel dropbutton__item dropbutton__item--extrasmall dropbutton-action secondary-action">
        <a href="/" hreflang="en">Devel</a>
      </li>
    </ul>
  </div>
</div>
seiplax’s picture

Same type of problem if you have set Paragraphs to use the modal when selecting what type of Paragraph to add.

Screenshot of Paragraphs Add button

Settings needed to repeat (in Form display mode settings for the content type the Paragraph is added to):

Screenshot of Paragraphs settings

And if you in the same settings use "Add mode: Dropdown button" you get:

Screenshot of Paragraphs Add button

LauraRocks’s picture

StatusFileSize
new2.76 KB

So 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.

LauraRocks’s picture

StatusFileSize
new41.24 KB
new35.37 KB

Here is paragraphs admin UI without patch
Before patch

And here is with patch (classes added)
After patch

lauriii’s picture

Issue summary: View changes
Status: Active » Needs work
Issue tags: +Needs manual testing
StatusFileSize
new50.55 KB
new27.87 KB

This 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.

sasanikolic’s picture

Status: Needs work » Needs review
StatusFileSize
new4.3 KB
new1.82 KB
new18.76 KB
new19.07 KB
new65.75 KB

Thanks 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.

LauraRocks’s picture

As @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:

foreach (Element::children($elements, TRUE) as $child) {
  // Clone the element as an operation.
    $operations[$child] = ['title' => $elements[$child]];
  // Flag the original element as printed so it doesn't render twice.
    $elements[$child]['#printed'] = TRUE;
}

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!

sasanikolic’s picture

@LauraRocks can you check again with my patch (#31) applied, please? It seems to work fine for me on the Dropdown button.

LauraRocks’s picture

Yes, just edited my answer, I was too slow with answering, didn't check your answer, looks good now!

sasanikolic’s picture

Status: Needs review » Needs work

Great! 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.

lauriii’s picture

+1 to #35! I was thinking of opening follow-up for that but I'm happy if it gets done here 👍

sasanikolic’s picture

Status: Needs work » Needs review
StatusFileSize
new157.21 KB
new7.29 KB
new7.01 KB

Here 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.

chandeepkhosa’s picture

Thanks 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?

sasanikolic’s picture

Let's try to push this topic forward. Anyone can test properly? :)

miro_dietiker’s picture

saschaeggi’s picture

I've just tested this with the patch from #37 and for me it works with Drupal 8.8.2 against Paragraphs 1.10.x

saschaeggi’s picture

StatusFileSize
new7.79 KB

Updated 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).

miro_dietiker’s picture

I'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.

sasanikolic’s picture

StatusFileSize
new148.71 KB
new196.1 KB
new1.68 KB
new853 bytes

Rerorlled @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.

saschaeggi’s picture

@sasanikolic tested on Seven & Claro, does work great.

Claro:

Seven:

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

Before:

After:

  • Berdir committed 5989d57 on 8.x-1.x authored by saschaeggi
    Issue #3079128 by sasanikolic, rensingh99, saschaeggi, LauraRocks,...
berdir’s picture

Title: Broken Dropdown prevents Save » Broken Dropdown prevents Save in Claro
Status: Needs review » Fixed

Thanks everyone, if @saschaeggi says this is ready then I'm happy to believe that :)

Lots of people contributed here, thanks everyone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Jonny Gong’s picture

StatusFileSize
new1.08 KB
new20.93 KB
new21.6 KB

I rerorlled a patch based on #7 @lbesenyei and it works for me !
paragraph: 8.x-1.x
PHP: 7.3
Core: 8.8.x

eduardo morales alberti’s picture

I need to apply the #49 patch.

eduardo morales alberti’s picture

Issue summary: View changes
StatusFileSize
new58.65 KB
new55.03 KB

After update paragraph dev, to last version (dev-1.x 203ecf8)

Before apply patch #49:
Broken select list
After apply patch #49:
Nice select list