Problem/Motivation

The button with css class .field-add-more-submit has no vertical margin.
when a lot of this buttons are used inline. A second row wil be used. Without vertical margins the buttons stick to each other.

Steps to reproduce

This can be seen when using the buttons function in the Paragraphs form.

1. Install paragraph module
2. Create multiple paragraph types
3. Create a content type and add paragraph as reference field with 'Add mode' as buttons
4. Save the changes
5. Goto create content and check 'Add paragraphs' buttons have vertical margin
6. Verify this for various themes

Proposed resolution

Add 5px top and bottom margin

Remaining tasks

create a patch, test it, commit it.

Wrong behaviour:
Wrong

Wanted:
Wanted

CommentFileSizeAuthor
#42 afterpatch_stark.png140.59 KBdishakatariya
#42 afterpatch_olivero.png245.64 KBdishakatariya
#42 afterpatch_claro.png138.01 KBdishakatariya
#42 before-patch.png137.64 KBdishakatariya
#34 after_patch.png80.61 KBbhumikavarshney
#34 before_patch.png80.75 KBbhumikavarshney
#33 3198236-33.patch866 bytesarantxio
#27 Before_&_After_Patch_in_D10.1.1.PNG7.3 KBgaurav-mathur
#27 After_Patch_in_D10.0.0.PNG7.21 KBgaurav-mathur
#27 Before_Patch_in_D10.0.0.PNG7.44 KBgaurav-mathur
#25 3198236-After-Patch.png350.52 KBxyzsor
#24 after_patch_claro.png146.25 KBxyzsor
#22 3198236-22-D10.patch966 bytessmustgrave
#18 after_patch_olivero.png40.84 KBsonam.chaturvedi
#18 after_patch_gin.png32.96 KBsonam.chaturvedi
#18 after_patch_seven.png44.64 KBsonam.chaturvedi
#18 after_patch_claro.png32.3 KBsonam.chaturvedi
#18 before_patch5.png29.19 KBsonam.chaturvedi
#15 drupal9-3-6_seven.png117.04 KBjohan den hollander
#15 drupal9-3-6_gin.png97.37 KBjohan den hollander
#15 drupal9-3-6_claro.png84.48 KBjohan den hollander
#12 Before-patch.png16.93 KBMadhu kumar
#11 Before_paragraph_allignment.png16.93 KBradheymkumar
#9 paragraph_allignment.png16.93 KBvikashsoni
#5 3198236-5-add-another-vertical-margin.patch972 bytesmstrelan
#4 Schermafdruk van 2021-02-15 10-28-54.png41.77 KBjohan den hollander
#3 3198236-add-another-vertical-margin.patch950 bytesmstrelan
Schermafdruk van 2021-02-12 18-13-52.png267.15 KBjohan den hollander
Schermafdruk van 2021-02-12 17-48-46.png167.29 KBjohan den hollander

Issue fork drupal-3198236

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

johandenhollander created an issue. See original summary.

johan den hollander’s picture

Title: Add another buttons could use vertical margin » "Add another" buttons could use vertical margin
mstrelan’s picture

Status: Active » Needs review
StatusFileSize
new950 bytes

Attached patch adds a margin of 0.5rem to the top and bottom of these buttons. This is computed from the --space-xs variable which equates to 8px.

johan den hollander’s picture

StatusFileSize
new41.77 KB

Thanks @mstrelan. This makes it look a lot better.

screenshot of first patch result

However I feel the vertical margin could be a bit smaller.
Why not make it the same as the horizontal margin between the buttons?

mstrelan’s picture

StatusFileSize
new972 bytes

@johandenhollander I simply chose the smallest defined variable for margins already available.

The buttons have no left margin but have a right margin of 12px (0.75rem). Adding the 8px (0.5rem) to the top and bottom margin makes a 16px gap. I've attached another patch that reduces the new vertical margin to match the horizontal margin.

FWIW the fact this was previously set to 0 margin suggests there may have been a reason for it.

johan den hollander’s picture

Ok. It looks good now. Could you see if there was a related issue?
I pressume no vertical margin was needed because it was not expected that so many buttons were ever used that it needed a second row of buttons.

mstrelan’s picture

The 0 margin seems to have been introduced here: https://www.drupal.org/project/claro/issues/3023326#comment-13244734

johan den hollander’s picture

Issue summary: View changes
Related issues: +#3023326: Field Cardinality Style Update

As far as I can judge the added margin will not cause any disturbances then.

Let's see if we can have more people review this.

vikashsoni’s picture

StatusFileSize
new16.93 KB

This issue is not exists and fixed

poorva’s picture

RTBC +1

radheymkumar’s picture

StatusFileSize
new16.93 KB

There are proper alignment and proper padding available

Madhu kumar’s picture

StatusFileSize
new16.93 KB

Could not find any issue proper vertical margins are available for button

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

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should 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

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -Claro button margin +Bug Smash Initiative

From #9, #11, and #12, it doesn't seem like this is reproducible.

@Johan den Hollander Would you check this is still an issue? And, if so, for what version.

For those testing, it's useful to know what Drupal version you tested with.

johan den hollander’s picture

StatusFileSize
new84.48 KB
new97.37 KB
new117.04 KB

@Kristen Pol I just tested this again.

Drupal core 9.3.6 / paragraphs 8.x-1.12 (also tested with dev)
Seven theme: Ok.

Claro theme: Not ok.

Gin theme: Ok, see https://www.drupal.org/project/gin/issues/3218033

See attached screenshots.

kristen pol’s picture

Version: 9.3.x-dev » 9.4.x-dev
Status: Postponed (maintainer needs more info) » Needs review
Issue tags: +Needs manual testing

Thank you for reproducing the issue again @johandenhollander. Reopening this.

1. Patch is straight forward though not sure it is the approach the Claro team would approve.

2. Changing issue to version 9.4. The patch applies cleanly to 9.3 and 9.4 and with offsets for 10:

[drupal-10.0.x-dev/10.0.x] [drupal-10.0.x-dev]$ patch -p1 < 3198236-5-add-another-vertical-margin.patch 
patching file core/themes/claro/css/components/form--field-multiple.css
patching file core/themes/claro/css/components/form--field-multiple.pcss.css
Hunk #1 succeeded at 9 (offset -2 lines).

3. Tagging for testing for 9.4. The steps to reproduce could be more clear but, for those who know how to use paragraphs, they should be able to reproduce. It would be good to add more explicit testing steps for those who are not familiar.

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.

sonam.chaturvedi’s picture

Issue summary: View changes
StatusFileSize
new29.19 KB
new32.3 KB
new44.64 KB
new32.96 KB
new40.84 KB

Verified and tested patch #5. Patch applied successfully on 9.5.x-dev.
Updated steps to reproduce in issue summary.

Test Steps:
1. Install paragraph module
2. Create multiple paragraph types
3. Create a content type and add paragraph as reference field with 'Add mode' as buttons
4. Save the changes
5. Goto create content and check 'Add paragraphs' buttons have vertical margin

Test Results:
Seven theme: Ok
seven

Claro theme: Ok
claro

Olivero theme: Ok
olivero

Gin theme: Ok
gin

RTBC +1

kristen pol’s picture

Issue tags: -Needs manual testing

@sonam.chaturvedi Thanks for testing!

It looks like the code was reviewed previously and this has been tested.

It would be good to do a double check of core gates before marking RTBC.

No more manual testing is needed, thanks!

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed the patch and looks good.
Still applies to 9.5

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This will need a 10.x patch because we no longer support IE so the result of yarn run build:css is different after applying this patch.

smustgrave’s picture

Status: Needs work » Needs review
StatusFileSize
new966 bytes

D10 patch

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

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

xyzsor’s picture

Status: Needs review » Needs work
StatusFileSize
new146.25 KB

Hello @smustgrave,
I have reviewed by applying your patch and it's working fine.
I am adding screenshot for reference, The screenshot is of before patch, i renamed it wrong so don't get confused.

xyzsor’s picture

Status: Needs work » Needs review
StatusFileSize
new350.52 KB

Applied Patch #22 successfully. It is working as expected.

gaurav-mathur’s picture

Assigned: Unassigned » gaurav-mathur
gaurav-mathur’s picture

Patch #22 applied successfully on on Drupal 10.0.x-dev,The patch work properly
but not working in Drupal 10.1.x-dev for me.
Refer to screenshots.

gaurav-mathur’s picture

Assigned: gaurav-mathur » Unassigned
smustgrave’s picture

Thank you for the interest @gaurav-mathur but screenshots were added in the comments before.

ranjit1032002’s picture

Status: Needs review » Reviewed & tested by the community

Patch #22 applied successfully and it's working as expected

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

This adds some inconsistency to the spacing. This is quite visible on the top of the button. Ideally we would adjust the container margin to take this into account, but the form-action class is used elsewhere and I'm not sure how easy it would be for us to add additional classes there. It's important that the spacing on top of the button remains somewhat where it is now because that way we make sure that users associate it to the right element, and it doesn't look too separate.

Alternative solution we could try out is to handle this with margin-bottom, but that's likely not going to work because it will probably make the spacing on the bottom of the button inconsistent.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

arantxio’s picture

StatusFileSize
new866 bytes

I've created a patch that applies to D10.2, it's kinda the same as #22, except it uses the margin-block instead of margin-top and bottom.

bhumikavarshney’s picture

Status: Needs work » Needs review
StatusFileSize
new80.75 KB
new80.61 KB

Hello @Arantxio,
Patch #33 applied successfully,The patch work properly.
please refer to screenshots.

smustgrave’s picture

Status: Needs review » Needs work

This needs to be made against 11.x as the development branch. And need to make sure #31 is addressed.

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

gauravvvv’s picture

Status: Needs work » Needs review

Addressed #31 & #35.

meeni_dhobale’s picture

Reviewing this current MR/commit.

meeni_dhobale’s picture

I am trying to review this commit on 11.x branch but I'm not able to reproduce the main issue.

dishakatariya’s picture

Assigned: Unassigned » dishakatariya
dishakatariya’s picture

Assigned: dishakatariya » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new137.64 KB
new138.01 KB
new245.64 KB
new140.59 KB

Verified and tested after taking pull from this branch- 3198236-add-another-buttons. (#38) on the Drupal version 11.x. Its working as expected for the various themes.
Followed the below Testing Steps:
1. Install paragraph module
2. Create multiple paragraph types
3. Create a content type and add paragraph as reference field with 'Add mode' as buttons
4. Save the changes
5. Goto create content and check 'Add paragraphs' buttons have vertical margin
Attaching the screenshot for reference.
Hence moving it to RTBC
Thanks!

  • lauriii committed e16d8e0f on 11.x
    Issue #3198236 by mstrelan, Gauravvvv, smustgrave, Johan den Hollander,...

  • lauriii committed 48b93f6f on 10.2.x
    Issue #3198236 by mstrelan, Gauravvvv, smustgrave, Johan den Hollander,...
lauriii’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed e16d8e0 and pushed to 11.x. Cherry-picked to 10.2.x as a non-disruptive bug fix to Claro. Thanks!

Status: Fixed » Closed (fixed)

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