Problem/Motivation

Icons are not alligned properly with the corresponding text in several pages.
This issue is related to #2208319: Icon misaligned in admin/reports/updates

To reproduce the bug go to admin/config.

Icon Misaligned

To reproduce the bug go to admin/report/status.

Icon Misaligned

To reproduce the bug go to admin/report/updates/update and go back one page.

Icon Misaligned

Proposed resolution

Align icon with label.

Remaining tasks

?

User interface changes

New icon alignment.

API changes

None.

CommentFileSizeAuthor
#103 misaligned_icons-2213583-103.patch4.92 KBherom
#103 interdiff-2213583-reroll-103.patch712 bytesherom
#103 interdiff-2213583-98-reroll.patch2.4 KBherom
#103 aligned-icons-rtl.png15.91 KBherom
#98 misalligned_icons_in-2213583-98.patch2.8 KBpushpinderchauhan
#95 interdiff-88-95.txt498 bytessqndr
#95 misalligned_icons_in-2213583-95.patch2.8 KBsqndr
#94 misalligned_icons_in-2213583-94.patch2.83 KBsqndr
#94 interdiff-88-94.txt522 bytessqndr
#90 2213583_after.png514.59 KBg-raph
#90 2213583_before.png509.84 KBg-raph
#89 missaligned-icons01.jpg222.29 KBpakmanlh
#88 interdiff-2213583-84-88.txt1.13 KBlauriii
#88 misalligned_icons_in-2213583-88.patch2.78 KBlauriii
#84 misalligned_icons_in-2213583-84.patch2.34 KBjamesquinton
#83 misalligned_icons_in-2213583-83.patch2.32 KBjamesquinton
#83 rtl-arrows.png82.77 KBjamesquinton
#81 Extend___drupal8_dev.png385.42 KBlewisnyman
#81 Extend___drupal8_dev.png403.63 KBlewisnyman
#79 misaligned_icons_in-2213583-79-after.png40.91 KBzserno
#79 misaligned_icons_in-2213583-79-before.png40.93 KBzserno
#78 misalligned_icons_in-2213583-78.patch2.32 KBzserno
#76 icons_after.png74.19 KBlauriii
#76 icons_before.png77.68 KBlauriii
#74 misalligned_icons_in-2213583-74-after.png28.1 KBesod
#74 misalligned_icons_in-2213583-74-before.png23.47 KBesod
#74 misalligned_icons_in-2213583-74.patch2.32 KBesod
#70 misalligned_icons_in-2213583-70.patch2.29 KBlauriii
#65 Screen Shot 2014-07-07 at 22.25.20.png67.16 KBlauriii
#65 Screen Shot 2014-07-07 at 22.42.42.png78.1 KBlauriii
#65 Screen Shot 2014-07-07 at 22.42.50.png61.69 KBlauriii
#65 interdiff-2213583-59-65.txt1.13 KBlauriii
#65 misalligned_icons_in-2213583-65.patch2.41 KBlauriii
#61 screenshot-1-ie8-after.png92.19 KBgippy
#61 screenshot-1-ie8-before.png96.41 KBgippy
#60 screenshot-1-firefox-before.png85.39 KBgippy
#60 screenshot-1-firefox-after.png94.2 KBgippy
#60 screenshot-1-chrome-before.png141.34 KBgippy
#60 screenshot-1-chrome-after.png136.19 KBgippy
#59 interdiff-2213583-51-59.txt1.02 KBamitgoyal
#59 drupal8-misalligned_icons_in_drupal_8-2213583-59.patch1.92 KBamitgoyal
#56 drupal8errors.zip3.48 MBAnonymous (not verified)
#51 drupal8-misalligned_icons_in_drupal_8-2213583-51.patch2.16 KBrajendar reddy
#47 screenshot_2213583_status_css_fix.png11.48 KBmathieso
#47 screen_issue_2213583_1.png29.17 KBmathieso
#46 misalligned_icons_in_drupal_8-2213583-46.patch2.08 KBlauriii
#43 misalligned_icons_in_drupal_8-2213583-43.patch2.41 KBlauriii
#40 misalligned_icons_in_drupal_8-2213583-39.patch910 byteslauriii
#39 Screen Shot 2014-03-28 at 10.57.03.png74.17 KBlauriii
#34 2213583-ajax-error-page-misalignment.png36.74 KBmcjim
#31 misalligned_icons_in_drupal_8-2213583-31.patch862 byteslauriii
#27 afterPatch.png92.87 KBCrisz
#26 before-patch-3.png85.91 KBMaster_Hipsto
#26 before-patch-2.png72.93 KBMaster_Hipsto
#26 before-patch-1.png77.41 KBMaster_Hipsto
#26 after-patch-3.png75.58 KBMaster_Hipsto
#26 after-patch-2.png87.1 KBMaster_Hipsto
#26 after-patch-1.png73.51 KBMaster_Hipsto
#24 patchScreen3.png61.66 KBCrisz
#24 patchScreen2.png61.39 KBCrisz
#24 patchScreen1.png86.87 KBCrisz
#23 error.png127.19 KBCrisz
#23 error.png127.19 KBCrisz
#19 misalligned_icons_in_drupal_8-2213583-19.patch801 bytessqndr
#14 misalligned_icons_in_drupal_8-2213583-14.patch1.28 KBCrisz
#11 misalligned_icons_in_drupal_8-2213583-11.patch1.28 KBCrisz
#8 misalligned_icons_in_drupal_8-2213583-8.patch1.58 KBCrisz
#5 misalligned_icons_in_drupal_8-2213583-5.patch1.62 KBCrisz
#1 seven_theme_misaligned_icons-2213583-1.patch301 bytescs_shadow
admin_report_status_availableupdates(back).png47.76 KBJayeshSolanki
admin_report_status2.png84.12 KBJayeshSolanki
admin_configuration.png65.44 KBJayeshSolanki

Comments

cs_shadow’s picture

Status: Active » Needs review
StatusFileSize
new301 bytes

Attached is a patch for the same. Though, need to check whether this intended.

longwave’s picture

Component: CSS » Seven theme

This patch only seems to affect Seven, so moving to that component.

lewisnyman’s picture

Status: Needs review » Needs work

This patch only seems to modify the horizontal alignment but the report suggests we need to modify the vertical alignment?

cs_shadow’s picture

Oh, I overlooked vertical alignment part, my bad. I'll upload a patch for the same shortly.

Crisz’s picture

Component: Seven theme » CSS
StatusFileSize
new1.62 KB

Actually this issue also happens when Bartik is the main admin theme, this patch should address the problem in both Bartik and Seven. =)

Crisz’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: misalligned_icons_in_drupal_8-2213583-5.patch, failed testing.

Crisz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.58 KB

Oh, formatting error, sorry about that, this one should be fine.

anksy’s picture

Status: Needs review » Reviewed & tested by the community

The patch works fine and solves all the listed issues.

lokapujya’s picture

why the new line on line 156?

Crisz’s picture

I probably accidently added that line while editing the file, this following patch doesn't have this issue. Thanks for noticing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 11: misalligned_icons_in_drupal_8-2213583-11.patch, failed testing.

lokapujya’s picture

Please add a space between .messages and {

Crisz’s picture

StatusFileSize
new1.28 KB
Crisz’s picture

Status: Needs work » Needs review
anksy’s picture

#10 Yeah I missed the extra line in the patch. But this patch looks good.I can't find any errors.

lokapujya’s picture

Issue tags: -css-novice Novice +CSS novice, +Novice
Anonymous’s picture

Last patch looks good to me. Solves the problem

sqndr’s picture

+++ b/core/modules/system/css/system.theme.css
@@ -540,7 +540,9 @@ ul.tabs {
+.progress .messages {
+  background-position: 10px 25px;
+}

Don't know why you should add this. Doesn't seem like this is part of the solution? I removed these lined and created a new patch.

lewisnyman’s picture

Status: Needs review » Reviewed & tested by the community

This is looking better! Thanks.

webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs accessibility review

Would love an "after" screenshot here. Also, tentatively tagging "Needs accessibility review," because I thought that the reason we put the icon right up next to the *top* of a very long error message was for accessibility, though I'm not totally sure about that.

rob3000’s picture

just tested the patch and added screenshots as per webchick's request in
#21.

Crisz’s picture

StatusFileSize
new127.19 KB
new127.19 KB

The reason why this piece of code is there is because without it, the last example given in the description will continue wrong.

+++ b/core/modules/system/css/system.theme.css
@@ -540,7 +540,9 @@ ul.tabs {
+.progress .messages {
+  background-position: 10px 25px;
+}

problem

Crisz’s picture

StatusFileSize
new86.87 KB
new61.39 KB
new61.66 KB

The following screenshots are the result of the patch 14 that I previously submitted.

patch 14 screenshot 1

patch 14 screenshot 1

patch 14 screenshot 1

Crisz’s picture

Master_Hipsto’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new73.51 KB
new87.1 KB
new75.58 KB
new77.41 KB
new72.93 KB
new85.91 KB

Patch number 19 and new drupal version that implemented new icons fixed this issue.

Crisz’s picture

StatusFileSize
new92.87 KB

No, it does not fix.

To reproduce this, just run the update script locally with no internet connection. Tested on the latest Drupal 8 dev version.

Crisz’s picture

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

Status: Needs review » Needs work

The reason why it's not working with the AJAX error is because the message is wrapped in <pre>, which has it's own padding and margin depending on the theme (Bartik has a different background colour for it, too).

There doesn't appear to be specific styling for .messages pre: maybe that's what we need here?

As an aside, I created a sandbox module to deliberately create an AJAX error: https://drupal.org/sandbox/mcjim/2227053
Going to /error tries to run a batch which fails, giving a nice error to work with :-)

lauriii’s picture

Assigned: Unassigned » lauriii
lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new862 bytes

Added separated style for .messages pre

lauriii’s picture

Assigned: lauriii » Unassigned
mcjim’s picture

mcjim’s picture

StatusFileSize
new36.74 KB

Patch in #31 is looking good, though there's still mis-alignment until #2220905: Misaligned messages status is resolved.

The only issue is the AJAX error pages, which output the messages to the content rather than to #console, so don't have margin on the left.

lauriii’s picture

Do you have any example where the left margin issue could be tested?

mcjim’s picture

@lauriii I pushed a sandbox project just for this: https://drupal.org/sandbox/mcjim/2227053
You'll need to clone it: https://drupal.org/project/2227053/git-instructions

It's just a module: you can put it in /modules then enable it. Then you can visit http://your-site/error in your browser to trigger an AJAX error.

lauriii’s picture

Thanks for the module. Whats the problem we are discussing? I think I didn't quite get that.

sqndr’s picture

mcjim++

Thanks for the module!

lauriii’s picture

StatusFileSize
new74.17 KB
lauriii’s picture

And the patch..

mcjim’s picture

Thanks, @lauriii, patch is almost there!
A couple of suggestions:

Icon position (possibly controversial!):

In system.theme.css, change line 517 from background: no-repeat 10px 18px; to background: no-repeat 10px 17px;. I think the icons need to go up a teeny tiny bit, and this looks right to me.

#console margin on node/add pages

Change margin: 0 2em; to margin: 0 0 0 8px; on line 1503.
This fixes the extra, unnecessary margin on the node/add pages introduced in #2095275: Space above add content form with no overlay

Remove the extra 8px margin from messages--status

Perhaps we could do that in this patch?

mcjim’s picture

Status: Needs review » Needs work
lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new2.41 KB

Status: Needs review » Needs work

The last submitted patch, 43: misalligned_icons_in_drupal_8-2213583-43.patch, failed testing.

lauriii’s picture

Status: Needs work » Needs review
lauriii’s picture

mathieso’s picture

StatusFileSize
new29.17 KB
new11.48 KB

Error message icon looks ok on Firefox/Ubuntu.

But is the check mark for the status message too low?

Disabling a CSS line fixes it:

This is what it looks like with the CSS line disabled:

Only local images are allowed.

mcjim’s picture

Status: Needs review » Needs work

@mathieso I agree, I think the check mark is better higher up.
@lauriii Otherwise, I think the patch is good! :-)

droplet’s picture

+++ b/core/modules/system/css/system.admin.css
@@ -206,6 +206,7 @@ table.system-status-report td.status-icon div {
+  margin-top: 2px;

+++ b/core/modules/system/css/system.theme.css
@@ -514,7 +514,7 @@ ul.tabs {
+  background: no-repeat 10px 17px;  /* LTR */

It seems only 2 lines related to this issue. Please focus on it only.

mcjim’s picture

OK. We can restrict this issue to the misaligned icons only and create a new issue for the misaligned messages themselves or just update the issue summary to reflect what's in the patch. Happy to do either, as long as we end up with nicely aligned messages :-)

rajendar reddy’s picture

I think we can remove separate position for status messages

+++ b/core/modules/system/css/system.theme.css
@@ -545,15 +545,12 @@ ul.tabs {
-  background-position: 12px 19px;  /* LTR */

remaining things looks good.

rajendar reddy’s picture

Assigned: Unassigned » rajendar reddy
Status: Needs work » Needs review
mgifford’s picture

I can't see an accessibility problem with this patch. What needs to be done to RTBC it?

lewisnyman’s picture

Issue tags: +needs-screenshots

I think we're going to need before/after screenshots in Seven/Bartik/Stark to get this committed. The changes are very subtle.

lewisnyman’s picture

Issue tags: +frontend, +CSS
Anonymous’s picture

StatusFileSize
new3.48 MB

I've used Wraith to get some screenshots of before/after. It is subtle, but it's there!

Pop the html in the attached zip into your browser to have a gander.

Sumit kumar’s picture

Status: Needs review » Needs work

The last submitted patch, 51: drupal8-misalligned_icons_in_drupal_8-2213583-51.patch, failed testing.

amitgoyal’s picture

Status: Needs work » Needs review
StatusFileSize
new1.92 KB
new1.02 KB

Please review revised patch as patch in #51 no longer applies in the current code.

gippy’s picture

Patch 59 successfully resolved the problem on the following browsers: Chrome (mac), Safari (mac), Opera (mac), Firefox (mac) and Internet Explorer 8 (Crossover on Mac).

gippy’s picture

StatusFileSize
new96.41 KB
new92.19 KB
gippy’s picture

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

Assigned: rajendar reddy » Unassigned
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/seven/style.css
@@ -140,7 +140,17 @@ ul.menu li.expanded {
 #console {
-  margin: 9px 0 10px;
+  margin: 9px 0 10px 8px;
+}
...
+.content .messages {
+  margin-left: 8px;
 }

What about rtl?

lauriii’s picture

Added RTL support. Some pictures here:

Status: Needs review » Needs work

The last submitted patch, 65: misalligned_icons_in-2213583-65.patch, failed testing.

damien tournoud’s picture

Title: Misalligned Icons in Drupal 8.x » Misaligned Icons in Drupal 8.x
lewisnyman’s picture

Issue tags: -CSS novice, -needs-screenshots +Needs reroll
lauriii’s picture

Issue tags: -Needs reroll
StatusFileSize
new2.29 KB
lauriii’s picture

Status: Needs work » Needs review
kimkl91c’s picture

Status: Needs review » Needs work
esod’s picture

Assigned: Unassigned » esod
esod’s picture

Status: Needs work » Needs review
StatusFileSize
new2.32 KB
new23.47 KB
new28.1 KB

Rerolled the patch. Here are before and after screen shots.

Before:


After:

mgifford’s picture

Status: Needs review » Needs work

Looks like the spacing is off for:

+.messages pre {
+ margin: 0;
+}

I'm also curious about the changes to [dir="rtl"] .messages--status {

I'd just like some comment on that as it's a change from #70 and I don't know why.

lauriii’s picture

StatusFileSize
new77.68 KB
new74.19 KB

The reason for the changes to [dir="rtl"] .messages--status { is this:

Before:

After:

lewisnyman’s picture

Thanks for the detailed screenshots. The code looks good, I have one question:

+++ b/core/themes/seven/css/style.css
@@ -127,7 +127,23 @@ ul.menu li.expanded {
+.content .messages {
+  margin: 0 0 0 8px; /* LTR */
+}
+[dir="rtl"] .content .messages {
+  margin: 0 8px 0 0;
 }

Is there a good reason to include the .content class in the selector?

zserno’s picture

Status: Needs work » Needs review
StatusFileSize
new2.32 KB

Fixed indentation according to #75.

zserno’s picture

Tested latest patch without the .content class in the selector according to #77
Before:

After:

thamas’s picture

FYI I created a related issue: #2321121: Remove #console

lewisnyman’s picture

Status: Needs review » Needs work
StatusFileSize
new403.63 KB
new385.42 KB

Thanks, really close with this I think.

I found a little bit of weirdness on the status messssages when testing ltr->rtl

The background position styling for messages--status doesn't kick in but it looks fine


But for RTL it does and it looks wrong.

Maybe we just need to delete the background position styling for messages--status?

thamas’s picture

Related issues: +#2321121: Remove #console
jamesquinton’s picture

Assigned: esod » Unassigned
Status: Needs work » Needs review
StatusFileSize
new82.77 KB
new2.32 KB

I've removed the background position - looks good to me.

I did notice however that the arrows on the expandable detail elements does get quite close to the text - screenshot attached.

jamesquinton’s picture

StatusFileSize
new2.34 KB

Swapped #console to .messages. As said in #2321121, this appears to not cause any further issues.

gábor hojtsy’s picture

#2321121: Remove #console was closed as duplicate.

thamas’s picture

@jamesquinton, @Gábor Hojtsy - closing #2321121: Remove #console means that removing #console from the twig file should be also done here.

lewisnyman’s picture

Status: Needs review » Needs work
  1. +++ b/core/themes/seven/css/style.css
    @@ -124,10 +124,23 @@ ul.menu li.expanded {
    +[dir="rtl"] .messages {
    +    margin: 9px 8px 10px 0;
    +}
    +
    +.messages pre {
    +  margin: 0;
    +}
    

    We don't need a blank line here.

  2. +++ b/core/themes/seven/css/style.css
    @@ -124,10 +124,23 @@ ul.menu li.expanded {
    +.content .messages {
    +  margin: 0 0 0 8px; /* LTR */
    +}
    +[dir="rtl"] .content .messages {
    +  margin: 0 8px 0 0;
    

    What is this code for? Why do we override .messages when inside .content? Is it for the node creation page?

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new2.78 KB
new1.13 KB

I didn't find any case where .content .messages would happen. I also removed #console in this patch.

pakmanlh’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new222.29 KB

After apply the misalligned_icons_in-2213583-83.patch it looks nice, here I attached an screenshot.
Cheers!

g-raph’s picture

Issue tags: +FUDK
StatusFileSize
new509.84 KB
new514.59 KB

I applied patch from #88 and everything looks ok. See screenshots before and after. Good work!

longwave’s picture

Is the if statement redundant now?

ie.

      {% if messages %}
        {{ messages }}
      {% endif %}

could become just

      {{ messages }}
webchick’s picture

Status: Reviewed & tested by the community » Needs review

Good question.

sqndr’s picture

Hm. The if is used to print a markup container if there is a value to be printed inside it (from the Twig coding standards).

+++ b/core/themes/seven/css/style.css
@@ -124,10 +124,16 @@ ul.menu li.expanded {
+.messages {
+  margin: 9px 0 10px 8px; /* LTR */
+}

+++ b/core/themes/seven/templates/page.html.twig
@@ -86,7 +86,7 @@
-        <div id="console" class="clearfix">{{ messages }}</div>
+        {{ messages }}

Why is the div removed? Should this be something like:
<div class="messages">?

sqndr’s picture

StatusFileSize
new522 bytes
new2.83 KB

So - here's a quick update.

sqndr’s picture

StatusFileSize
new2.8 KB
new498 bytes

Right, forget about #94. The {messages} doesn't need a div around it, because it's added in a preprocess. The patch from #88 seems to be fine.

Comment #91 is correct. We can remove the if. I've attached a patch, and tested this patch with @Laurii at Frontend United in Copenhagen. :)

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Tested this manually and it works. Fixes the issue pointed by webchick in comment #92

herom’s picture

Minor nitpick:

+++ b/core/themes/seven/templates/page.html.twig
@@ -85,9 +85,7 @@
+        {{ messages }}

Extra indentation.

pushpinderchauhan’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.8 KB

Just removed the extra space as mentioned by @herom in #97. Again pushing to Need Review to ensure get passed through Test Bot.

lauriii’s picture

herom’s picture

Status: Needs review » Reviewed & tested by the community

ok. back to RTBC.

droplet’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/system/css/system.theme.css
@@ -523,7 +523,7 @@ ul.tabs {
+  background: no-repeat 10px 17px;  /* LTR */

@@ -598,8 +594,9 @@ table tr.warning {
+  background-position: 99.3% 19px;

default background position is '10px 17px'. RTL is diff.

Really don't like use percentage offset value. It has bad result on smaller screen width. Why not use background-origin?? ( http://caniuse.com/#search=background-origin )

Or apply the CSS rule to inner DIV + padding. eg:

[dir="rtl"] .messages--error > div {
  background-image: url(http://s7b6de091c3666dc.s2.simplytest.me/core/misc/icons/ea2800/error.svg);
  background-position: right 2px;
  background-repeat: no-repeat;
  padding-right: 24px;
}
gábor hojtsy’s picture

Anybody interested to move this forward? I came from #2318381: Message not styled properly on interface translation page which was postponed on #2321121: Remove #console which was marked as duplicate of this one. So for the sake of these things happening, now that it is all bundled up in this bigger issue, how do we ensure it happens? :)

herom’s picture

Here we go.
Needed a reroll after #2321505: Split Seven's style.css into SMACSS categories, which deleted the seven style.css, and moved the #console styling to a separate file. So, there are two interdiffs: one for the reroll, and one to address #101.

Also attached a screenshot that the RTL still looks fine.

EDIT: Oops, posted the interdiffs with .patch. Sorry for the below noise.

The last submitted patch, 103: interdiff-2213583-reroll-103.patch, failed testing.

The last submitted patch, 103: interdiff-2213583-98-reroll.patch, failed testing.

lewisnyman’s picture

Status: Needs review » Reviewed & tested by the community

It seems like we can use background-position: right 10px top 17px; instead of the percentage so that works great. I don't think I was even aware of that. Well done!

I manually tested the patch just to double check and I think it looks good. Onwards!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 877b9c6 and pushed to 8.0.x. Thanks!

  • alexpott committed 877b9c6 on 8.0.x
    Issue #2213583 by lauriii, sqndr, Crisz, herom, jamesquinton, esod,...
gábor hojtsy’s picture

sqndr’s picture

Nice work. This got in! Woop woop! :)

Status: Fixed » Closed (fixed)

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