Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Bartik seems to somehow mess up the number in an <ol> list in a <blockquote> tag. The first list item number is not showing at all and the second gets number 1.
You can see an example on this in this post. Just scroll down the page for the quote. When looking at the source code, there is nothing wrong, everything is properly marked up, but the output is not correct.
Comment | File | Size | Author |
---|---|---|---|
#9 | IE6-before.jpg | 75.79 KB | amateescu |
#9 | IE6-after.jpg | 75.79 KB | amateescu |
#9 | IE7-before.jpg | 79.73 KB | amateescu |
#9 | IE7-after.jpg | 76.04 KB | amateescu |
#7 | almost_right.png | 19.06 KB | benjifisher |
Comments
Comment #1
benjifisherI see the problem: lines 162-164 of bartik/css/style.css are
This CSS rule does not apply just to the first child of the <blockquote> tag. It applies to any tag that is the first of its kind within a parent element, as long as it is inside the blockquote! In particular, the first <li> element in the <ol> is affected. Try a nested list: even worse!
The safest thing is to remove the offending lines. A reasonable alternative is to replace them with this version:
This has the desired effect if the block quote starts with a <p> element. I cannot think of any problems if the first paragraph comes later. I have no idea what the effect will be in IE6.
I am still new at this. I hope it is appropriate for me to change the status to "needs work."
Comment #2
benjifisherThe more I test it, the more I like using
blockquote > p:first-child
. This correctly targets what we want, the first child element of the blockquote. It gets ugly if we useblockquote > :first-child
since the first child might be a list. Are there any elements other than<p>
where we want it to apply? If not, I think this is the right fix.Comment #3
tsvenson CreditAttribution: tsvenson commentedThanks @benjifisher, your fix works perfect for me. The quote is now showing as I expected it.
Comment #4
jensimmons CreditAttribution: jensimmons commentedHmm. We need some screenshots of before and after. And cross-browser testing (with screenshots). I'm glad its working so far, but in order to make sure we don't introduce a new problem in Drupal 7.1, we must test it more thoroughly before patching Drupal core.
Comment #5
benjifisher@jensimmons,
I have attached before and after screenshots using Chrome 8, Firefox 3.6, and Safari 5 on Mac OS. When I said that nested lists looked ugly before the patch, I was not kidding!
Just to be clear: before means Drupal 7.0, and after means after applying my patch in comment #2.
Comment #6
benjifisherMore screen shots, this time from Windows 7. My opinion is that the verdict is unanimous as far as modern browsers are concerned. I am not an expert on older browsers, but I think that any browser that recognizes the
:first-child
selector should also implement the> p:first-child
selector.Comment #7
benjifisher@jensimmons,
What does it take to commit a bug fix?
I realize that I am new here, and thus have not yet established any credibility. Nonetheless, if there was ever a patch that did not need thorough testing, this is it. I am the first to admit when I am hacking and not sure if I have the right patch. Not here. I know enough CSS to recognize this as a bug.
The patch adds three characters ... one of which is a space. Does it get any simpler?
Look at the CSS selector
blockquote :first-child
and look at what it does in the screen shots. If necessary, check the docs on w3.org or w3schools. It targets way more than intended. A big improvement is to use the selectorblockquote > :first-child
. This targets only the first child of the blockquote.There is still a problem if the first child of the blockquote is something like
<ol>
or<ul>
. (See the screen shot attached to this comment.) That is why I changed the selector toblockquote p:first-child
. Now, maybe this is too restrictive. Maybe you want some other elements to be rendered in-line if they are at the start of a blockquote. If so, that is a feature request, not a bug. For example, we might add the selectorblockquote > div:first-child
. Now, that would require testing!I exaggerated when I said I had "no idea" how this would look on IE6. I think that IE6 does not support
:first-child
, and perhaps it does not support>
either. If so, then it should ignore any version of this line.Comment #8
amateescu CreditAttribution: amateescu commentedTested this in IE6 and 7, attached screenshots.
In IE6 the patch makes no difference because IE6 doesn't support :before/:after and :first-child, so there no need to print the first blockquote child element inline.
In IE7 it makes a difference because IE7 supports :first-child but not :before/:after, so the quotes are not printed but ol's and ul's are messed by the :first-child selector.
Also tested this in every other browser (FF 3.6, Chrome, IE8, Opera) and benjifisher's logic and screenshots are correct.
I think that the patch from #2 is our best way to go here.
Comment #9
amateescu CreditAttribution: amateescu commentedForgot the screenshots.
Comment #10
tim.plunkettAlso tested and confirmed.
Comment #11
webchickGreat, thanks for all the testing of this fix, folks!
Committed to HEAD.