Problem/Motivation

The block placement page implements a custom two column layout in CSS.

Proposed resolution

Remove the custom CSS and implement the reusable classes introduced in #2017257: Create generic layout classes

Remaining tasks

Document before-and-after testing on RTL.

User interface changes

None

API changes

None

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because coding standards
Issue priority Not critical because coding standards
Unfrozen changes Unfrozen because it only changes CSS/markup
CommentFileSizeAuthor
#45 replace-block-placement-page-layout-css-2335531-45.patch3.25 KBpjbaert
#45 interdiff-33_45.txt840 bytespjbaert
#40 interdiff-2335531-26-33.txt933 bytesMathieuSpil
#37 rtl-after-block-layout.png231.68 KBManjit.Singh
#37 rtl-before-block-layout.png231.43 KBManjit.Singh
#37 after-block-layout.png229.04 KBManjit.Singh
#37 before-block-layout.png229.46 KBManjit.Singh
#35 Screen Shot 2015-05-15 at 18.07.36.jpg315.69 KBLewisNyman
#35 Screen Shot 2015-05-15 at 18.07.28.jpg573.13 KBLewisNyman
#33 2335531_33.patch2.64 KBvijaykumar.info99
#32 block_manage_after.png816.09 KBvijaykumar.info99
#31 block_manage_before.png791.83 KBvijaykumar.info99
#30 2422399-47.patch3.73 KBvijaykumar.info99
#26 replace-block-placement-page-layout-css-2335531-26.patch2.72 KBMathieuSpil
#23 replace-block-placement-page-layout-css-2335531-23.patch2.68 KBMathieuSpil
#23 Screen Shot 2015-05-07 at 20.09.53.png87.73 KBMathieuSpil
#21 replace-block-placement-page-layout-css-2335531-21.patch2.63 KBManjit.Singh
#21 interdiff-2335531-19-21.txt911 bytesManjit.Singh
#19 interdiff-2335531-7-19.txt913 bytesMathieuSpil
#19 replace-block-placement-page-layout-css-2335531-19.patch2.71 KBMathieuSpil
#7 replace-block-placement-page-layout-css-2335531-7.patch2.33 KBMathieuSpil
#7 2335531-before-and-after.jpg694.45 KBMathieuSpil
#4 replace-block-placement-page-layout-css-2335531-4.patch2.29 KBpjbaert
#4 interdiff-replace-block-placement-page-layout-css.txt2.12 KBpjbaert
#2 replace-block-placement-page-layout-css-2335531-2.patch667 bytespjbaert
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LewisNyman’s picture

Issue tags: +Novice

These classes need replacing:

.layout-block-list clearfix => .layout-container
.layout-region => .layout-column
.block-list-primary -> .three-quarters
.block-list-secondary => .quarter
pjbaert’s picture

Status: Active » Needs review
FileSize
667 bytes

Removed the custom CSS and implemented the reusable classes

LewisNyman’s picture

Status: Needs review » Needs work

@pjbaert Nice, thanks. It seems like we have to keep the .block-list-secondary class because it is used for some styling:

In block.admin.css:

.block-list-secondary {
  border: 1px solid #bfbfbf;
  border-bottom-width: 0;
}

Let's keep it for now and try and figure out how we can remove it in another issue.

.block-list-primary {
    float: left; /* LTR */
    width: 75%;
    padding-right: 2em;
  }
  [dir="rtl"] .block-list-primary {
    float: right;
    padding-left: 2em;
    padding-right: 0;
  }

  .block-list-secondary {
    float: right; /* LTR */
    width: 25%;
  }
  [dir="rtl"] .block-list-secondary {
    float: left;
  }

We can remove this CSS from block.admin.css

/**
 * The vertical toolbar mode gets triggered for narrow screens, which throws off
 * the intent of media queries written for the viewport width. When the vertical
 * toolbar is on, we need to suppress layout for the original media width + the
 * toolbar width (240px). In this case, 240px + 780px.
 */
@media
screen and (max-width: 1020px) {

  .toolbar-vertical.toolbar-tray-open .block-list-primary,
  .toolbar-vertical.toolbar-tray-open .block-list-secondary {
    float: none;
    width: auto;
    padding-right: 0;
  }
}

This is useful CSS that we can use for all of the layout-column classes. Can we move this CSS into system.admin.css but replace the selectors with just: .toolbar-vertical.toolbar-tray-open .layout-column

pjbaert’s picture

Hi @LewisNyman

Thanks for the feedback.
I processed you remarks from #3 in this patch.

MathieuSpil’s picture

Assigned: Unassigned » MathieuSpil
MathieuSpil’s picture

Issue tags: +drupaldevdays
MathieuSpil’s picture

1. Fixed typo in classname: .three-quarters should be .three-quarter
2. The html of the sidebar: We should keep the .block-list-secondary-class inside the twig for its border. And we should also keep the quarter-class for the width properties. The html is now:

<div class="layout-column quarter block-list-secondary">
    {{ form.place_blocks }}
</div>

3. Fixed weird whitespace in/after media-query:

@media
screen and (max-width: 1020px) {

is now

@media screen and (max-width: 1020px) {

4. Removed the extra use of the.layout-container-class. Otherwise we are nesting .layout-container inside .layout-container

5.

Let's keep it for now and try and figure out how we can remove it in another issue.

@Lewis: I don't think we should keep this for another issue, now the page looks weird because the sidebar now receives a padding-left of 10px (because it is the second layout-container in it's parent) But the .block-list-secondary-class gives it a border-left... Which is a bad combination (weird whitespace, see screenshot...)

I suggest we don't try to restyle this page but rewrite some css so there is no visual change, and it still works with the new layout classes?

MathieuSpil’s picture

Assigned: MathieuSpil » Unassigned
MathieuSpil’s picture

Status: Needs review » Needs work

The last submitted patch, 7: replace-block-placement-page-layout-css-2335531-7.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: replace-block-placement-page-layout-css-2335531-7.patch, failed testing.

MathieuSpil’s picture

I think this ticket should be postponed after we decide on #2471791: Improve the CSS layout framework for Drupal's admin interface or we should already finish point 5 of #7. Because this will stay an issue after the new generic classes for backend pages.

LewisNyman’s picture

I think we can still make this improvement before #2471791: Improve the CSS layout framework for Drupal's admin interface because we don't have to change the generic layout classes very much to apply them to this page and I worry that it might take a while to figure out what we want.

MathieuSpil’s picture

Ok, so all TODO's can now be found in #7.

MathieuSpil’s picture

Status: Needs work » Needs review

Setting to needs review to the patch can be properly tested before anyone starts working further on this.

MathieuSpil’s picture

Status: Needs review » Needs work
MathieuSpil’s picture

Status: Needs work » Needs review
Issue tags: +Needs screenshots
FileSize
2.71 KB
913 bytes

Added a extra div so the border can be applied to the inner div.
I am also not sure if the .entity-meta is being used anywhere else.
If not all border-specifications can also be deleted out of entity-meta.css:

  .entity-meta {
  background-color: #ececec;
  border-bottom: 0;
  border-left: 1px solid #bfbfbf;
  border-right: 1px solid #bfbfbf;
  border-top: 0;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, .15);
  margin-top: 0;
  padding-top: 0;
}
LewisNyman’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/block/css/block.admin.css
    @@ -25,9 +25,12 @@
    +.block-list-secondary > div {
    

    It would be better if we could use a class here like .block-list-secondary instead of a div element.

  2. +++ b/core/modules/block/templates/block-list.html.twig
    @@ -19,3 +19,5 @@
    +	<div>
    +  	{{ form.place_blocks }}
    

    Looks like some blank white space leaked in here. I use these settings for Sublime that automatically removes whitespace https://www.drupal.org/node/1346890

Manjit.Singh’s picture

pjbaert’s picture

Status: Needs work » Needs review

The changes made by @Manjit.Singh look correct.
Triggering the testbot.

MathieuSpil’s picture

Because the new layout-classes use padding as a way for separation, we can not use the border-left and the padding on the same element, that was why I added a extra div.
The solution of Manjit now has visual regression that looks like this (patch #21):

@Lewis: It would be better indeed without the extra div, but we can only apply a border on the elements that are inside the .block-list-secondary-class. And because one of them uses margin as a way to position it, we can't apply the border on that. (Or we should refactor a whole bunch of stuff.)
Maybe we can add a .block-list-secondary--inner-class, but that seems a bit silly to me.

So thanks for the tips on setting up for no more whitespace!
Assuming the patch #21 was a wrong approach because of visual regression (But not really sure), I reworked patch #19 so it no longer contains the wrong whitespace.

LewisNyman’s picture

block-list-secondary__inner sounds like a good idea to me, better than a div

MathieuSpil’s picture

Status: Needs review » Needs work

Alright! Setting back to needs work

MathieuSpil’s picture

Status: Needs work » Needs review
FileSize
2.72 KB

Based upon last patch, i used the block-list-secondary__inner-class instead of a div.

MathieuSpil’s picture

LewisNyman’s picture

Status: Needs review » Needs work
+++ b/core/modules/block/css/block.admin.css
@@ -25,9 +25,12 @@ a.block-demo-backlink:hover {
+.block-list-secondary__inner {

Ah sorry, it looks like it doesn't make sense to have block-list-secondary__inner if we don't use block-list-secondary. Maybe we just need to move the block-list-secondary class?

vijaykumar.info99’s picture

Hey guys,

My name is Vijay from DrupalCon LA! I just applied the latest patch from #26 to my local and we still see 3 lint errors.

Line	Column	Message
49	1	Don't use IDs in selectors.
52	1	Don't use IDs in selectors.
55	1	Don't use IDs in selectors.

Can we just convert the IDs to classes?

Thanks,
Vijay

vijaykumar.info99’s picture

Status: Needs work » Needs review
FileSize
3.73 KB

-- Removing an accidentally added patch --

vijaykumar.info99’s picture

FileSize
791.83 KB

Screenshots W.R.T the fixes I added at #30

vijaykumar.info99’s picture

FileSize
816.09 KB

Screenshots W.R.T the fixes I added at #30

vijaykumar.info99’s picture

FileSize
2.64 KB

Hey guys,

Spoke with Lewis and he explained me that the linting errors will be handled as a part of a different issue. So now I worked on updating the files as per #28.
Please review.

Thanks,
Vijay

vijaykumar.info99’s picture

LewisNyman’s picture

Component: node system » block.module
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs screenshots
FileSize
573.13 KB
315.69 KB

Thanks for the patch! Here are the screenshots of the block placement screen on wide and narrow looking good.

xjm’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs manual testing, +Needs screenshots

Thanks everyone for your work on this issue including the screenshots.

+++ b/core/modules/block/css/block.admin.css
@@ -58,25 +61,6 @@ a.block-demo-backlink:hover {
-    float: left; /* LTR */
...
-    float: right; /* LTR */
...
-  [dir="rtl"] .block-list-secondary {
-    float: left;
-  }

+++ b/core/modules/system/css/system.admin.css
@@ -368,3 +368,17 @@ small .admin-link:after {
+    padding-right: 0;

We've got some LTR and RTL code being removed, but only one direction of padding being added. We need to have manual testing in RTL as well that's documented in the summary with before-and-after screenshots to ensure there is no RTL regression.

Manjit.Singh’s picture

There some changes in width of table and "Place Blocks". Please check before and after screenshots.

atl

atl

atl

atl

MathieuSpil’s picture

MathieuSpil’s picture

Status: Needs work » Reviewed & tested by the community

Alright!

So thanks @manjit for the work on the screenshots.
The change in widths are caused by the use of the layout-classes that use a different amount of padding instead of using the custom padding previously defined.
The screenshots also show that all visual changes are correct. and there is no RTL-regression on the blocks.

@vijaykumar.info99
Thanks for your work on this! But I do have some feedback for you:
You should try to name your patch the same way as the last uploaded patch of the ticket. (So instead of 2335531_33.patch It should have been named replace-block-placement-page-layout-css-2335531-33.patch) This way it is easier for people working on this ticket to download your patch and apply it on their local install etc..
You should also consider adding an interdiff file so everyone up-to-date with this ticket can read the interdiff so they can see very easily what you changed since last patch.
(I added one for clarity's sake, so everyone can see you indeed incorperated Lewis his feedback in #28)

@Lewis:
Tested the latest patch too and everything looked fine indeed.

Off-topic:
In the screenshots of Manjit, you can see a rtl-regression on the menu above the blocks (too much margin-right in comparison with the LTR-screenshots)
This is the case on both the before and the after-screenshots, so is there a already a ticket about this?

MathieuSpil’s picture

FileSize
933 bytes
Manjit.Singh’s picture

@MathieuSpil

regarding offtopic, It would be good if you can highlight that RTL margin in comparison with the LTR in screenshots.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/system/css/system.admin.css
@@ -368,3 +368,17 @@ small .admin-link:after {
+/**
+ * The vertical toolbar mode gets triggered for narrow screens, which throws off
+ * the intent of media queries written for the viewport width. When the vertical
+ * toolbar is on, we need to suppress layout for the original media width + the
+ * toolbar width (240px). In this case, 240px + 780px.
+ */
+@media screen and (max-width: 1020px) {
+  .toolbar-vertical.toolbar-tray-open .layout-column {
+    float: none;
+    width: auto;
+    padding-right: 0;
+  }
+}

I think this code means that we can remove the following code from block.admin.css

/**
 * The vertical toolbar mode gets triggered for narrow screens, which throws off
 * the intent of media queries written for the viewport width. When the vertical
 * toolbar is on, we need to suppress layout for the original media width + the
 * toolbar width (240px). In this case, 240px + 780px.
 */
@media
screen and (max-width: 1020px) {

  .toolbar-vertical.toolbar-tray-open .block-list-primary,
  .toolbar-vertical.toolbar-tray-open .block-list-secondary {
    float: none;
    width: auto;
    padding-right: 0;
  }
}
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/system/css/system.admin.css
@@ -368,3 +368,17 @@ small .admin-link:after {
+/**
+ * The vertical toolbar mode gets triggered for narrow screens, which throws off
+ * the intent of media queries written for the viewport width. When the vertical
+ * toolbar is on, we need to suppress layout for the original media width + the
+ * toolbar width (240px). In this case, 240px + 780px.
+ */
+@media screen and (max-width: 1020px) {
+  .toolbar-vertical.toolbar-tray-open .layout-column {
+    float: none;
+    width: auto;
+    padding-right: 0;
+  }
+}

I think this code means that we can remove the following code from block.admin.css

/**
 * The vertical toolbar mode gets triggered for narrow screens, which throws off
 * the intent of media queries written for the viewport width. When the vertical
 * toolbar is on, we need to suppress layout for the original media width + the
 * toolbar width (240px). In this case, 240px + 780px.
 */
@media
screen and (max-width: 1020px) {

  .toolbar-vertical.toolbar-tray-open .block-list-primary,
  .toolbar-vertical.toolbar-tray-open .block-list-secondary {
    float: none;
    width: auto;
    padding-right: 0;
  }
}
pjbaert’s picture

Assigned: Unassigned » pjbaert
pjbaert’s picture

Assigned: pjbaert » Unassigned
Status: Needs work » Needs review
FileSize
840 bytes
3.25 KB

you're right @alexpott.
Since we moved this code to system.admin.css, we can remove this part from block.admin.css

marieke_h’s picture

Status: Needs review » Reviewed & tested by the community

The changes suggested by @alexpott are correctly processed in #45. This can go back to RTBC.

idebr’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/system/css/system.admin.css
@@ -368,3 +368,17 @@ small .admin-link:after {
+    padding-right: 0;

.layout-column has no padding-right, so this line has no effect. Instead, it should be padding-left to target .layout-column + .layout-column in system.admin.css:29 with an additional override for RTL for [dir="rtl"] .layout-column + .layout-column in system.admin.css:32

MathieuSpil’s picture

Status: Needs work » Needs review

Hi @idebr, I think you are taking this ticket one step too far.

This ticket is mainly about implementing the layout-classes on the admin/structure/block page.
But this feedback can be posted in a follow-up ticket or a ticket dedicated to the layout-classes, or admin links-specific.

Can someone point to the correct ticket for feedback on this?

tim.plunkett’s picture

This can likely be closed as a duplicate after #2512456: Implement the new block layout design to emphasize the primary interaction of placing a block, unless someone things we should still genericize this

LewisNyman’s picture

Status: Needs review » Postponed
Manjit.Singh’s picture

Status: Postponed » Active
LewisNyman’s picture

Status: Active » Closed (cannot reproduce)

This page no longer has a two column layout