Problem/Motivation

A CSS regression was introduced to resolve a critical #2550981: Remove SafeMarkup::set in FormErrorHandler::displayErrorMessages()

Before #2550981 issue was fixed.

After Fixed #2550981 issue

Proposed resolution

Fix CSS on UL in the error messages. Probably fine to keep it on a new line just doesn't need the indent.

With latest patch in #13

Remaining tasks

User interface changes

Fix CSS regression.

API changes

Data model changes

Follow-up to #2550981: Remove SafeMarkup::set in FormErrorHandler::displayErrorMessages()

CommentFileSizeAuthor
#60 fix_inline_list_css-2557367-60.patch11.51 KBdavidhernandez
#50 Fix-inline-list-CSS-2557367-50.patch11.91 KBStudiographene
#49 Fix-inline-list-CSS-2557367-49.patch11.91 KBnikky171091
#44 fix_inline_list_css-2557367-44.patch12.45 KBmadhavvyas
#40 fix_inline_list_css-2557367-40.patch13.14 KBemma.maria
#34 Screen Shot 2015-09-08 at 3.06.00 PM.png36.78 KBdavidhernandez
#29 seven-fromerrors-rtl.png47.99 KBdavidhernandez
#29 seven-views-rtl.png26.84 KBdavidhernandez
#29 bartik-views-rtl.png29.25 KBdavidhernandez
#29 bartik-formerrors-rtl.png64.31 KBdavidhernandez
#29 classy-views-rtl.png18.05 KBdavidhernandez
#29 classy-formerrors-rtl.png57.99 KBdavidhernandez
#29 stark-views-rtl.png17.73 KBdavidhernandez
#29 stark-formerrors-rtl.png47.63 KBdavidhernandez
#28 stark-formerrors.png128.57 KBdavidhernandez
#28 stark-views.png160.12 KBdavidhernandez
#28 classy-formerrors.png209.05 KBdavidhernandez
#28 classy-views.png174.76 KBdavidhernandez
#28 bartik-formerrors.png181.75 KBdavidhernandez
#28 bartik-views.png176.97 KBdavidhernandez
#28 seven-views.png141.82 KBdavidhernandez
#28 seven-formerrors.png159.76 KBdavidhernandez
#26 interdiff-13to26.txt5.65 KBdavidhernandez
#26 fix_inline_list_css-2557367-26.patch13.07 KBdavidhernandez
#23 Form_error_style_test___Site-Install.png45.85 KBjoelpittet
#23 Form_error_style_test___Site-Install.png53.76 KBjoelpittet
#13 interdiff.txt5.13 KBjoelpittet
#13 fix_error_message-2557367-13.patch10.91 KBjoelpittet
#11 fix_error_message-2557367-11.patch5.93 KBjoelpittet
#11 interdiff.txt3.94 KBjoelpittet
#5 2557367.4.patch3.5 KBalexpott
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelpittet created an issue. See original summary.

Wim Leers’s picture

Status: Reviewed & tested by the community » Active

No patch yet, so think the RTBC here was accidental? :)

joelpittet’s picture

Thanks @Wim Leers, cloning abnormality:P

alexpott’s picture

Status: Active » Needs review
alexpott’s picture

star-szr’s picture

Issue tags: +frontend

Thanks!

Wim Leers’s picture

+++ b/core/themes/classy/classy.libraries.yml
@@ -3,6 +3,9 @@ base:
+      # We can not attach this in the item-list.html.twig template since it is
+      # often used during RendererInterface::renderPlain().
+      css/dataset/item-list.css: {}

Let me repeat my concern/comment from the original issue:

#57.3: aahhh! So this is basically a case where a message for drupal_set_message() does need to bubble attachments. That was not at all clear to me on my first reading.

joelpittet’s picture

joelpittet’s picture

A note on whitespace modifiers in Twig. Control and comment statements remove the newlines after themselves so you only need them for spaces in most cases.

Show and tell: http://twigfiddle.com/5aiuow

joelpittet’s picture

@Wim Leers can you elaborate on what #7 means here. A bit confused as to what to do with that info.

joelpittet’s picture

Here's a touch-up of the templates with an attribute object to hang those classes on(we usually try to add attributes using that object), also cleaned up the whitespace modifiers some and added them to core template as well (may break those tests).

Removed the overqualified selector (div) and added a class as a modifier. Likely needs someone to review the CSS selector for the nested list inside the wrapper, but I agree in general it will be much easier to style the component from the outside (as we can see it's hard to style the div that contains that inline class).

Status: Needs review » Needs work

The last submitted patch, 11: fix_error_message-2557367-11.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
FileSize
10.91 KB
5.13 KB

Did break those tests, huzzah. Hopefully this fixes them.

xjm’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Part of this got added in #2550981: Remove SafeMarkup::set in FormErrorHandler::displayErrorMessages(), so we need to reroll the patch on top of that.

Both @davidhernandez and @alexpott had a couple concerns in the other issue.

  • The CSS to fix up the inline-ness of the item lists should probably be in Classy, so that Bartik, Seven, and any other themes that extend classy have the expected formatting.
  • #2550981: Remove SafeMarkup::set in FormErrorHandler::displayErrorMessages() added a fix specifically targeting the visual regression of having an indentation at the beginning of the inline list.
  • There was some disagreement about whether an inline list should be rendered as a block level element (i.e. comma-separated, but on its own line), or whether it should be truly inline (so that, for example, it could appear in the same line as the rest of a paragraph of text). I'd lean toward allowing it to be inline, but I lost track of all the specific concerns here.
  • There was also some concern about how well the inline lists currently support other item list functionality like titles and descriptions,

Once we have some consensus on this issue and the fixes (whatever they may be) are committed, we should do a couple things:

  1. Revisit the fix from #2550981: Remove SafeMarkup::set in FormErrorHandler::displayErrorMessages() (which is a good example of how an inline list could be used) and update it. (Needs followup.)
  2. Update the weird "DayMonthHourMinute" tests to ensure complete coverage without testing for words that don't actually exist, testing instead for the presence of the jump links. (Needs followup.)
  3. Go back to other places where we used (e.g.) a |safe_join with commas, and convert them to the inline lists too. (Needs followup.)
xjm’s picture

Component: forms system » CSS
Category: Task » Bug report
xjm’s picture

madhavvyas’s picture

Issue tags: -Needs reroll

Re-rolled not required. Latest patch tried in Drupal 8.0.x branch after rebase It works for me.

joelpittet’s picture

Status: Needs work » Needs review

@xjm I wonder how much of that needs to be done here? Although a few of those items I believe are resolved by the proposed patch.

The CSS to fix up the inline-ness of the item lists should probably be in Classy, so that Bartik, Seven, and any other themes that extend classy have the expected formatting.

The styles are moved to classy.

added a fix specifically targeting the visual regression of having an indentation at the beginning of the inline list.

That was also resolved here as well I believe.

There was some disagreement about whether an inline list should be rendered as a block level element (i.e. comma-separated, but on its own line), or whether it should be truly inline (so that, for example, it could appear in the same line as the rest of a paragraph of text). I'd lean toward allowing it to be inline, but I lost track of all the specific concerns here.

I went with it should show up inline, but with the class on the wrapper that is now a one line CSS change.

There was also some concern about how well the inline lists currently support other item list functionality like titles and descriptions,

That may be out of scope of this issue but it doesn't remove them it just doesn't explicitly style them different from other item lists.

Update the weird "DayMonthHourMinute" tests to ensure complete coverage without testing for words that don't actually exist, testing instead for the presence of the jump links. (Needs followup.)

I may have misread this but I removed the broken twig template in head with the whitespace fixes in this patch.

xjm’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

@madhavvyas, reroll means exactly rebasing with the patch applied and resubmitting the updated patch on the issue. :)

@joelpittet, honestly I'm not entirely sure; @alexpott and @davidhernandez were the ones with concerns (see the other issue).

xjm’s picture

Also, we should probably manually test this again once it's rerolled... the screenshots in the summary are not current.

xjm’s picture

Title: Fix error message display with inline list CSS » Fix inline list CSS

Oh also:

There was also some concern about how well the inline lists currently support other item list functionality like titles and descriptions...

That may be out of scope of this issue but it doesn't remove them it just doesn't explicitly style them different from other item lists.

Let's manually test with those too and add screenshots of what that looks like. I think it should be in scope for this issue to make sure they don't look stupid.

joelpittet’s picture

Assigned: Unassigned » davidhernandez
Status: Needs work » Needs review

@xjm It doesn't need a re-roll I tested it too, both git apply and patch -p1 work. What command are you using that is saying it needs a re-roll?

I was discussing on IRC with @davidhernandez as I made the changes to ensure he was cool with them, but could get his opinion FTR.

joelpittet’s picture

Updated the screenshots with latest from head in the IS

Before the patch

With latest patch in #13

davidhernandez’s picture

+++ b/core/themes/classy/templates/dataset/item-list.html.twig
@@ -19,10 +20,11 @@
+  {%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %}

I don't think we actually need to do this now. I'll try to take a look later today. A lot of this can be simplified now that we are moving the CSS to Classy.

xjm’s picture

Thanks @joelpittet.

Can we test with the other features of item lists like title and description and empty to see what it looks like?

davidhernandez’s picture

I still argue the inlining is the responsibility of messages to set since it is the outer wrapper, not the inline list, but I won't dwell on it.

I was able to refactor some (I had to stop myself from going down the rabbit hole. Is it too late to refactor all of core's CSS?) This allowed some simplifying of Bartik's override and completely removing what was added in Seven. Also, deleting a number of other declarations. Yay!

I'm ok with this. It should be the most flexibly overridable. I checked the form errors (Thanks to stefan.r's awesome little module.) and the lists on the Views list page. I checked all four themes LTR and RTL. Didn't make screenshots though. It's late here.

joelpittet’s picture

Issue tags: +Needs screenshots

I'm OK with the changes:) Needs screenshots as said in #25

davidhernandez’s picture

Here is left to right. I can do right to left later. ...but don't let that stop anyone else from doing it. ;)

something something multiple file upload would be awesome.

davidhernandez’s picture

right to left

Skitch and Stefan's module have made this so much easier to do.

alexpott’s picture

So what are we going to do about the title support? <h3> tags don't play nicely with inlineness.

davidhernandez’s picture

I dunno. Do we have a usecase for that yet so it can be thought out?

I just realized there is css for .title. Why is that there? Did we remove that accidentally? We don't actually need it with the h3, but I don't know if that is just legacy.

alexpott’s picture

I don't think there is a use-case for it with a comma list but an inline div having h3 inside doesn't seem to make much sense - and it is possible to do with the current template.

joelpittet’s picture

We could for completion sake just inline the the h3 as well and tack on a colon?

H3 Title: item 1, item 2

davidhernandez’s picture

The item list title is an H3. I don't think it should be inline, it is not a label.

I hard-coded it real quick to see how it looks. It seems fine to me. I wouldn't expect it to, out-of-the-box, be treated any different. It's an H3,

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

#34 confirmed it is possible to use the h3 with inline lists though a very unlikely use-case and it doesn't look bad. Also very easy to override with CSS or override the template to make this work for uses cases.

Feel free to disagree but I think this is a nice fix that makes working with with this template much easier for themers, allowing them to target the wrapper container and it's child elements.

xjm’s picture

+++ b/core/includes/theme.inc
@@ -999,6 +999,7 @@ function template_preprocess_tablesort_indicator(&$variables) {
+  $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']);

This line of code makes my brain bendy.

Also, a few lines down, we have:

  foreach ($variables ['items'] as &$item) {
    $attributes = array();
    // If the item value is an array, then it is a render array.
    if (is_array($item)) {
      // List items support attributes via the '#wrapper_attributes' property.
      if (isset($item ['#wrapper_attributes'])) {
        $attributes = $item ['#wrapper_attributes'];
      }

Hash or no hash?! I confused. There may be a perfectly logical explanation for this, but that's what made me hesitate before committing.

xjm’s picture

Forgot to say, I'm okay with the title thing if others are. If you put an item list with a title in a sentence, well that is your silly. Thanks for the screenshots!

joelpittet’s picture

#wrapper_attributes are something @sun came up with I believe to let render elements pass around things. It is meant to move the attributes on to the <li> tag, as the wrapper is of each item's value is the the <li> and it can sometimes take render array. Same pattern for #type => table.

$variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']);
With all our other attributes we do this. I'd prefer to just instantiate an empty Attribute() in the hook_theme(). But that is untested approach.

These ones are "magically" done for all templates, and I tried to remove that magic #2108771: Remove special cased title_attributes and content_attributes for Attribute creation:

$variables['attributes'] 
$variables['content_attributes']
$variables['title_attributes']

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 26: fix_inline_list_css-2557367-26.patch, failed testing.

emma.maria’s picture

Status: Needs work » Needs review
FileSize
13.14 KB

I rerolled the patch.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Thank you emma. I diffed the diffs and the only move was the components are on component instead of theme.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 40: fix_inline_list_css-2557367-40.patch, failed testing.

davidhernandez’s picture

Issue tags: +Needs reroll
madhavvyas’s picture

madhavvyas’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

Status: Needs review » Needs work

The last submitted patch, 44: fix_inline_list_css-2557367-44.patch, failed testing.

The last submitted patch, 44: fix_inline_list_css-2557367-44.patch, failed testing.

davidhernandez’s picture

Issue tags: +Needs reroll
+++ b/core/modules/system/system.libraries.yml
@@ -19,6 +20,27 @@ base:
+    theme:
+      css/components/action-links.theme.css: { weight: -10 }
+      css/components/breadcrumb.theme.css: { weight: -10 }
+      css/components/button.theme.css: { weight: -10 }
+      css/components/collapse-processed.theme.css: { weight: -10 }
+      css/components/container-inline.theme.css: { weight: -10 }
+      css/components/details.theme.css: { weight: -10 }
+      css/components/field.theme.css: { weight: -10 }
+      css/components/form.theme.css: { weight: -10 }
+      css/components/icons.theme.css: { weight: -10 }
+      css/components/inline-form.theme.css: { weight: -10 }
+      css/components/link.theme.css: { weight: -10 }
+      css/components/links.theme.css: { weight: -10 }
+      css/components/menu.theme.css: { weight: -10 }
+      css/components/messages.theme.css: { weight: -10 }
+      css/components/progress.theme.css: { weight: -10 }
+      css/components/tableselect.theme.css: { weight: -10 }
+      css/components/tabledrag.theme.css: { weight: -10 }
+      css/components/tablesort.theme.css: { weight: -10 }
+      css/components/tabs.theme.css: { weight: -10 }
+      css/components/textarea.theme.css: { weight: -10 }

@madhavvyas, can you check your reroll? This shouldn't be there. This code above was committed the other day so it should already be in head.

nikky171091’s picture

Studiographene’s picture

madhavvyas’s picture

Status: Needs work » Needs review

The last submitted patch, 49: Fix-inline-list-CSS-2557367-49.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 50: Fix-inline-list-CSS-2557367-50.patch, failed testing.

madhavvyas’s picture

@davidhernandez When I check in HEAD, I do not found theme code as you specified

/core/modules/system/system.libraries.yml

davidhernandez’s picture

Did you rebase your branch with 8.0.x? Those CSS file moves, and the change to system.libraries.yml, were done on Sunday. And if you look at the patch in #40 and all the ones before, you'll see the code is not there.

The last submitted patch, 49: Fix-inline-list-CSS-2557367-49.patch, failed testing.

The last submitted patch, 50: Fix-inline-list-CSS-2557367-50.patch, failed testing.

madhavvyas’s picture

I have rechecked. I have rebased my 8.0.x branch using git pull --rebase
I do not found changes specified in comment #48
@davidhernandez Please advice if you referring any other branch.

davidhernandez’s picture

@madhavvyas the patch you uploaded in #44 had that code. It should not have been there. Please reroll from #26 or #40, not the patches after.

davidhernandez’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
11.51 KB

Let's see if this one works.

RainbowArray’s picture

Status: Needs review » Reviewed & tested by the community

Just finished a line by line comparison of the last RTBC patch with the newest patch. The only difference is that the old patch had to take care of moving the item list CSS to Classy and make a few edits in that file, while the new patch only needs to make those edits in the file that has already been moved to Classy in HEAD.

So as far as code goes, this is good to go. We could redo the manual testing, but I'm comfortable with moving this to RTBC since the code is the same line by line.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

@davidhernandez thanks for the screenshots. Committed 0e6abff and pushed to 8.0.x. Thanks!

  • alexpott committed 0e6abff on 8.0.x
    Issue #2557367 by davidhernandez, joelpittet, madhavvyas, alexpott,...

Status: Fixed » Closed (fixed)

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