Problem/Motivation

Image overlaps in Layout Builder with +Add block and +Add section.

Steps to reproduce

  1. Make Olivero the default theme.
  2. Enable Layout Builder module under Extensions.
  3. Go to Home > Administration > Structure > Content types > Article > Manage display.
  4. Under Layout options, check Layout Builder and save.
  5. Go to an Article page and click the Layout tab.
  6. Add a block and create a custom block.
  7. Add content to the block: title, body, and, in the body, add an image to align it to left and right.

Screenshots:

With patch:

Proposed resolution

Add twig files to add clearfix. See starterkit for example.

Remaining tasks

  1. Create patch
  2. Review patch
  3. Test patch
  4. Commit

User interface changes

Images will show up properly in layout builder.

API changes

Data model changes

Release notes snippet

Issue fork drupal-3209903

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tushar_sachdeva created an issue. See original summary.

aaron.ferris’s picture

Likely because the images are floated when aligned left/right, ill take a look when I get 5.

aaron.ferris’s picture

StatusFileSize
new1.46 KB

I would propose Olivero uses a text-with-summary template that extends the field template, with some additional classes to handle fields that can contain formatted text (and thus floated elements)

This is similar to the way the likes of Bartik (and Classy) handle these fields. Although its slightly different over there as they use an extension of a different template. The result should remain the same, clearfix is added to the field classes (which fixes this problem)

Feedback welcome.

aaron.ferris’s picture

Status: Active » Needs review
abhijith s’s picture

StatusFileSize
new45.95 KB
new42.76 KB
new46.68 KB
new42.99 KB

Applied patch #3 and it worked fine.

Before patch:

before1

before2

After patch:

after1

after2

RTBC +1

djsagar’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new232.98 KB
new161.32 KB
new232.39 KB
new236.56 KB

Position issue is resolved after applied #3 patch "3209903-olivero-text-with-summary-3.patch" so moving on RTBC.

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: 3209903-olivero-text-with-summary-3.patch, failed testing. View results

djsagar’s picture

Assigned: Unassigned » djsagar
aaron.ferris’s picture

This was passing tests up until recently, I'd need to look into the failures when I get 5 unless @djsagar gets there before me

aaron.ferris’s picture

StatusFileSize
new1.45 KB

Reroll attached

aaron.ferris’s picture

Assigned: djsagar » Unassigned
Status: Needs work » Needs review
guilhermevp’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new80.4 KB
new91.67 KB

Patch still works as intended and passes tests, so moving to RTBC

Just adding evidence:

Before

1

After

2

larowlan’s picture

Issue tags: +Bug Smash Initiative

I'm not sure this is the right fix.

If you look at #2358529: Right-aligned images in CKEditor appear to the right of other fields you can see that the text module defines these templates already, and each already add the clearfix class.

So the question is, why aren't those template suggestions being picked up in olivero.

Can someone please look at that twig debug output in HEAD for that field and ascertain what theme suggestions are being used.

It may be that there's something else going on here, e.g. with theme suggestions in Olivero

larowlan’s picture

Status: Reviewed & tested by the community » Needs review
Agnesh Tank’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.54 MB
new1.59 MB

Verified and tested patch#11(3209903-olivero-text-with-summary-11.patch) on Olivero 9.3.0-dev version with 9.3.x-dev
Patch applied successfully and result is Acceptable.

Testing Steps:

1. Home>Administration>Structure>Content types>Article,under layout options check layout builder.
(install the module)
2. Go to the article node, click on layout.(enable the layout option)
3. Add block, create a custom block & add content: title, body, and in the body add an image to align it to left and right.
4. Add that block on the article node-> Layout tab
5. Verify the before patch
6. Apply the patch from #11 comment (3209903-olivero-text-with-summary-11.patch)
7. Clear cache and reverify the FE output

Test result:
Patch worked as expected & custom block was properly displayed under the Image block when added on Article Layout

Status: Review & tested by Community

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

No-one answered #15

Removing credit from @Agnesh Tank as there were already screenshots.

Please see how we give credit

Indrajith KB made their first commit to this issue’s fork.

indrajithkb’s picture

StatusFileSize
new54.25 KB

Hi @larowlan I have checked the text module in 9.3.x

So the question is, why aren't those template suggestions being picked up in olivero.

Ans: Normally theme suggestion templates are only picked up when they are in themes. We explicitly define theme suggestions here so that the text field templates in core/modules/text/templates are picked up.
But this fix is not with 9.3.x version
You can see the difference form the text.module file with this patch

Adding twig debug output here

image

Here am done the MR by checking the bartik theme and text module, Please review the merge request !983

mherchel’s picture

Priority: Normal » Minor
mherchel’s picture

Status: Needs review » Needs work

This looks great! We need to remove the .text-formatted CSS class, and then it'll be perfect.

Gauravmahlawat made their first commit to this issue’s fork.

gauravvvv’s picture

MR updated as per #22, Removed .text-formatted CSS class from template.

gauravvvv’s picture

Status: Needs work » Needs review
mherchel’s picture

Status: Needs review » Reviewed & tested by the community

Looks great. Thank you!

lauriii made their first commit to this issue’s fork.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

@lauriii's MR comments need addressing.

lauriii’s picture

Status: Needs work » Needs review

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.

kristen pol’s picture

Issue summary: View changes
Issue tags: +Needs manual testing

Thanks for the update.

1. Reviewed the code and see it is similar to starterkit_theme/templates/field/field--text.html.twig.

2. Checked and the patch applies cleanly to Drupal 9.3, 9.4, and 10. Needs testing for all of these so tagging.

3. Removing Needs migration since I don't think it's relevant.

4. Updated issue summary wording, formatting, and steps to reproduce, and embedded screenshots.

kristen pol’s picture

Issue summary: View changes

One more tweak to steps to reproduce.

Satyajit1990’s picture

Issue summary: View changes
StatusFileSize
new494.55 KB
new404.91 KB

Hi @kristen,
Verified the issue with the patch : https://git.drupalcode.org/project/drupal/-/merge_requests/983.diff
Version : 9.4 & 9.3
Testing result : After adding single image either left / right, Images are appearing inside the border but It will more precious if the images will be displayed just above the Add block level.
And when adding 2 block with images left and right , the 1st block images displayed as broken.
Overall result is Fail from my point of view

Screenshot fo reference :

Satyajit1990’s picture

kristen pol’s picture

Thanks for testing @Satyajit1990 but I think the tool failed for you again... sigh. I assume you tried simplytest.me for that one.

I just tried testing with DrupalPod on Drupal 9.4 and it didn't apply the MR/patch automatically (even though I chose the branch) so I manually applied it from within DrupalPod. Then I tested by first trying Seven with the images and then switched to Olivero and tested again. They appeared to work the same.

Removing the testing tag as I just found out from @catch that when the patch applies to more than one version, we can just test on 9.4 or 10, i.e. we don't have to test on all versions... just ones with different MRs/patches.

This needs an issue summary update and then it should be good for RTBC.

kristen pol’s picture

Issue summary: View changes
StatusFileSize
new984.59 KB

Forgot to attach my results:

kristen pol’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs issue summary update

Updated issue summary to use the template. Marking RTBC based on the above.

  • lauriii committed 48c0591 on 10.0.x
    Issue #3209903 by IndrajithKB, aaron.ferris, Gauravmahlawat, Abhijith S...

  • lauriii committed dcefcaa on 9.4.x
    Issue #3209903 by IndrajithKB, aaron.ferris, Gauravmahlawat, Abhijith S...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

#14: those templates were moved to Classy in #2422679: copy text template to classy.

Committed 48c0591 and pushed to 10.0.x. Also cherry-picked to 9.4.x. Thanks!

Status: Fixed » Closed (fixed)

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