Problem/Motivation

If you create a custom block with a long name, it pushes the 'Place block' button out of place in the modal.

Steps to reproduce

  1. Install Drupal
  2. Create a custom block with a long name
  3. Go to the block layout page and click 'Place block'
  4. See that the buttons are out of alignment

Proposed resolution

Update CSS to keep button in place.

CommentFileSizeAuthor
#26 place-block-button-after-patch.png333.41 KBHarish1688
#26 place-block-button-before-patch.png419.94 KBHarish1688
#25 After_patch23.png78.7 KBsonam.chaturvedi
#25 Before_patch23.png78.15 KBsonam.chaturvedi
#23 3223061-23.patch424 bytesameymudras
#20 3223061-20.patch406 bytesmanojkumar_97
#20 After patch.png99.01 KBmanojkumar_97
#18 Before-patch.png43.87 KBmanojkumar_97
#18 After-patch.png37.9 KBmanojkumar_97
#17 3223061-17.patch405 bytesdjsagar
#15 after_patch.PNG35.09 KBDevashish Jangid
#15 before_patch.PNG41.38 KBDevashish Jangid
#13 3223061-13-after-patch.png286.71 KBsagarchauhan
#13 3223061-13.patch405 bytessagarchauhan
#11 After Patch 3223061.png444.55 KBchetanbharambe
#11 Before Patch 3223061.png433.65 KBchetanbharambe
#10 3223061-10.patch428 byteskatrienc
#8 After patch alignment.png140.13 KBmanojithape
#8 Before patch alignment.png130.41 KBmanojithape
#7 After_patch.png44.02 KBvikashsoni
#7 Before_patch.png41.72 KBvikashsoni
#5 322306-after-patch.png366.7 KBtanmaykadam
#5 322306-before-patch.png370.75 KBtanmaykadam
#5 place-block-table-3223061-5.patch405 bytestanmaykadam
#3 Screen Shot 2021-07-10 at 5.11.07 PM.png42.93 KBpameeela
Screenshot_1.png18.5 KBKumar Ashutosh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kumar Ashutosh created an issue. See original summary.

cilefen’s picture

Category: Task » Bug report
Status: Needs work » Active
Issue tags: -block, -Seven theme, -drupal core
pameeela’s picture

Title: When name has long text, breaking the UI » Long custom block name forces 'Place block' button out of place
Version: 8.9.x-dev » 9.3.x-dev
Issue summary: View changes
Issue tags: +Bug Smash Initiative
FileSize
42.93 KB

Thanks for reporting @Kumar Ashutosh and for providing the screenshot. I've just updated the title and issue summary a bit for clarity.

Also confirming it does not occur in Claro, only Seven.

tanmaykadam’s picture

Assigned: Unassigned » tanmaykadam
Status: Active » Needs work
tanmaykadam’s picture

Assigned: tanmaykadam » Unassigned
Status: Needs work » Needs review
FileSize
405 bytes
370.75 KB
366.7 KB

Please review the patch.

manojithape’s picture

Assigned: Unassigned » manojithape
vikashsoni’s picture

FileSize
41.72 KB
44.02 KB

Patch is working fine now the buttons are aligned for reference sharing screenshot ......
Thanks

manojithape’s picture

Assigned: manojithape » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
130.41 KB
140.13 KB

Verified and tested patch #5 on drupal 9.3.x dev version and Seven 9.3.0 Dev version.
Patch applied successfully and looks good to me.

Testing Steps:

  1. Log in as administrator and apply Seven theme
  2. Create a custom block with a long name
  3. Go to the block layout page and click 'Place block'
  4. Observe the buttons are out of alignment
  5. Now apply the patch and clear the cache
  6. Again Go to the block layout page and click 'Place block'
  7. Verify buttons should display properly aligned if the Block name is very long.

Expected Results:
The "Place block" buttons should be aligned properly if the Custom block name is very long.

Actual Results:
The "Place block" buttons are aligned properly if the Custom block name is very long.

Looks good to me. Moving this ticket to RTBC.

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/seven/css/components/tables.css
@@ -160,3 +160,7 @@ td > .form-item > .form-text,
+}

Although this fixes the issue as reported in a controlled test enviroment, it's a solution that introduces other problems.

This is limiting the length of every table cell within the table. Users with larger displays won't be able to take advantage of the additional viewport space. Longer titles/categories will be unnecessarily wrapped.

This is better addressed by targeting either the button itself, or determining why the table does not calculate button width when determining cell width.

Something like this would probably take care of it:

.js td .dropbutton-single .dropbutton-widget {
    position: static;
}

This is because the issue is probably due to it being a single-item dropbutton, and the widest (overflowing) part of the button is absolutely positioned and as a result not factored into the table cell width calculation. Since there's only one item in the button, the absolute positioning isn't necessary and making it static should allow the table to compute widths properly.

katrienc’s picture

Status: Needs work » Needs review
FileSize
428 bytes

I agree with bnjmnm

I've created a patch for this

chetanbharambe’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
433.65 KB
444.55 KB

Verified and tested patch #10.
Patch applied successfully and looks good to me.

Testing Steps:
# Goto: Appearance -> Apply Seven Theme
# Create a custom block with a long name
# Go to the block layout page and click on 'Place block'
# Observe the (Place block) buttons are out of alignment

Expected Results:
# The "Place block" buttons should be aligned properly if the Custom block name is very long.

Actual Results:
# Currently "Place block" buttons alignment is broken.

Please refer attached screenshots for the same.
Looks good to me.
Can be a move to RTBC.

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work
--- a/core/themes/seven/css/components/tables.css
+++ b/core/themes/seven/css/components/tables.css

This fix works, but should be applied to dropbutton-related css, not table-related css

The problem is caused by the following style in core/misc/dropbutton/dropbutton.css (without this rule, it defaults to the position: static; that fixes the issue

.js td .dropbutton-widget {
  position: absolute;
}

Which suggests it's potentially a problem in every theme, not just Seven where it happened to surface for the OP.

The position: absolute is necessary for multiple item dropbuttons, but causes the reported problem on single-item dropbuttons (and doesn't appear to provide any benefits). The ideal solution may be adjusting this rule to target only muti-item dropbuttons, or it may be adding a new style for single item ones.

What is there definitely works, but lets put it in the place where it'll work best for us!

sagarchauhan’s picture

Status: Needs work » Needs review
FileSize
405 bytes
286.71 KB

Created a new patch and tested it as per comments from @bnjmnm. Attached screenshot with the new patch.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Devashish Jangid’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
41.38 KB
35.09 KB

#13 Patch is working fine and shared the screenshot for the reference.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 13: 3223061-13.patch, failed testing. View results

djsagar’s picture

Status: Needs work » Needs review
FileSize
405 bytes

Just re-rolled the patch.

manojkumar_97’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
37.9 KB
43.87 KB

Before Patch:

After Patch:

#17 Patch is working fine and shared the screenshot for the reference.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: 3223061-17.patch, failed testing. View results

manojkumar_97’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
99.01 KB
406 bytes

After Patch

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/misc/dropbutton/dropbutton.css
    @@ -37,6 +37,9 @@
    +}
    

    Inherit is risky because it literally inherits from its parent element, so the value can differ depending on what the parent positition is set to.

  2. The overall approach in #20 is new. If this was a reroll, setting it to RTBC might be appropriate, but in this case it is self-RTBCing which isn't permitted. The RTBC must come from a reviewer who did not work on the implementation.
  3. In general I notice most of these patches are adding new styles specifically for dropbutton-single, but it may be worth looking into just modifying the style causing the problem to only target .dropbutton-multiple
    This causes the issue in single buttons
    .js td .dropbutton-widget {
      position: absolute;
    }

    so perhaps this would take care of it? (this would need manual confirmation)

    .js td .dropbutton-multiple .dropbutton-widget {
      position: absolute;
    }

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ameymudras’s picture

Thanks @bnjmnm that seems to be the right approach to me as well. I have added a patch based on your solution direction

ameymudras’s picture

Status: Needs work » Needs review
sonam.chaturvedi’s picture

FileSize
78.15 KB
78.7 KB

Verified and tested patch #23 on 9.5.x-dev. Patch applied successfully.

Test Steps:
1. Goto Appearance -> Apply Seven Theme
2. Create a custom block with a long name
3. Go to the block layout page and click on 'Place block'
4. Verify the 'Place block' button is not out of alignment

Test Result: The "Place block" buttons is aligned as expected when the Custom block name is very long.
Attached screenshot for reference. RTBC +1

Harish1688’s picture

Tested the patch (3223061-23.patch) with version 9.5.x-dev. working fine looks good for RTBC.
screenshot attached for references : place-block-button-before-patch.png , place-block-button-after-patch.png

Kristen Pol’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks, everyone! Marking RTBC based on:

  1. Patch applies cleanly.
  2. Tests pass.
  3. Title and issue summary are clear.
  4. Change is simple and addresses the issue from the issue summary.
  5. Not expected that tests are needed.
  6. Issue metadata looks okay.
  7. Manually tested and patch works as expected per above.
quietone’s picture

Compliments to @Kristen Pol for clearly stating what was done to support this issue being RTBC.

I am removing credit for duplicate screenshots made on the same patch.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 23: 3223061-23.patch, failed testing. View results

ravi.shankar’s picture

Status: Needs work » Reviewed & tested by the community

Back to RTBC as per comment #27.

  • bnjmnm committed 2ac364c on 10.1.x
    Issue #3223061 by manojkumar1997, tanmaykadam, sagarchauhan, ameymudras...

  • bnjmnm committed 4ace9b9 on 10.0.x
    Issue #3223061 by manojkumar1997, tanmaykadam, sagarchauhan, ameymudras...

  • bnjmnm committed 2e43a28 on 9.5.x
    Issue #3223061 by manojkumar1997, tanmaykadam, sagarchauhan, ameymudras...
bnjmnm’s picture

Status: Reviewed & tested by the community » Fixed

The thing happened! Applied to 10.1.x then cherry picked to 10.0.x and 9.5.x.

Also removed credit for rerolls where a reroll was not needed (basically uploading the same patch).

bnjmnm’s picture

Status: Fixed » Closed (fixed)

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

maxstarkenburg’s picture

In case anybody else out there is now seeing funky looking placement of their paragraphs buttons (as in below screenshot, for example) due to the change from this issue, I've opened #3331203: Core 9.5.0 causing broken-looking styling (Legacy widget, with Seven) in paragraphs (though I didn't rule out that a more appropriate fix might be a change here, I haven't read through all the above, and assume a change in paragraphs is path-of-far-less-resistance anyway).

paragraph Edit button looking off-kilter