Problem/Motivation

The toolbar has an arbitrary height in CSS, which means that without javascript enabled, height at top of the page is bigger than the toolbar. Note the white gap: in the following screenshot

The problem is that shortcuts.css, is still using px and has a height set on the ul for some reason, which causes it to not properly scale along with the rest.

Also, the padding-top on the body might be a bit too much.

Proposed resolution

Using only ems it is possible to get this right. We need to clean-up all pixel values.

In general, the patch should:

  • Convert all px values to ems for toolbar and shortcut modules
  • Make text resizable while keeping the top of the screen stick to the toolbar height
  • Allow us to remove javascript resizing for the toolbar
  • Not rely on javascript to place the toolbar

Remaining tasks

The latest patch in #84 fails in Chrome (see #85).

Questions to resolve

  • Do we want the toolbar height fixed in px or in ems ? Ems would be essentially to support IE text zooming.
  • If we go for ems, there may be some added pixels to the top padding of the page and top padding may not follow toolbar height when window is resized. Is that bad ?
  • If this is bad, we need to adjust the top padding using JS.
  • As we need to listen to text resizing and since the "resize" event does not fire properly in all browsers, we can't rely on it to resize the toolbar, so another solution from #17 may be considered as a reasonable tradeoff. The alternative is to support only browsers that fire the "resize" event.

Testing the patch manually

Any D8 patch will need to be tested in all core themes (Bartik, Stark, Seven) and all supported browsers (FF, Chrome, IE8, IE9). In each case:

  1. Disable JavaScript. Note the behavior in the screenshot below (white gap under the toolbar):
  2. Apply the patch and clear the site and browser caches. The gap should no longer be displayed:
  3. Test zooming in and out and verify that the toolbar is rendered properly on zoom.
  4. Verify that the patch doesn't have unintended side effects.
  5. Re-enable JavaScript and repeat the testing.

User interface changes

With patch (#83 comment) applied and no JS, it should leave exactly enough room for the toolbar, and when using text-zoom in the browser this should still be true.

Before:

After:

Original report by jide

The toolbar has an arbitrary height in CSS (using ems), which means that without javascript enabled, height at top of the page is bigger than the toolbar.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jide’s picture

Whoops ! Second screenshot is missing.

seutje’s picture

applied this patch and tried some text-zooming in FF with JS disabled -> http://gyazo.com/b7be49a2f05b0b69baba45759f2fd7b5.png
(similar result when using a rather big browser font-size)

jide’s picture

Text zooming is only affected in IE6, isn't it ? In this case, we would need to arbitrate between supporting text zooming in IE6 or having broken UI without javascript.
I would prefer the second solution personally.

seutje’s picture

the line-height seems to be just enough to prevent IE from shitting itself on largest font-size

jide’s picture

#2 : Also happens without the patch I think ?
#4 : So it means it is okay ?

seutje’s picture

FF text-zooming without js before patch -> http://gyazo.com/338675104d760aae645393ba8f4306ee.png

yea, it means at least IE is sorta kinda happy :P

jide’s picture

Indeed, you are right, this is more usable using ems than px, it is problematic to have some part of the page hidden on top.
So this may be a no-go.

seutje’s picture

tbh, I think the problem is that shortcuts.css is still using px and has a height set on the ul (and padding-top, always a good idea :P) for some reason, which causes it to not properly scale along with the rest

also, the padding-top on the body might be a bit too much

jide’s picture

Status: Needs review » Needs work

I made some progress on this. Using only ems it is possible to get this right.
We need to clean-up all pixel values in shortcut.css and toolbar.css.

I'll come back with a patch.

jide’s picture

Status: Needs work » Needs review
FileSize
2.87 KB
43.81 KB
356.16 KB
347.2 KB

This was not easy. But here it is.

It has many good things in it :

- Converts all px values to ems for toolbar and shortcut modules
- Makes text resizable while keeping the top of the screen stick to the toolbar height
- Allows us to remove javascript resizing for the toolbar
- Does not rely on javascript to place the toolbar

Moreover, with this patch, the technique used in #535066: Use CSS3 / IE filter to render toolbar shadow to resize the toolbar for IE in javascript is not useful anymore.

To summarize, it makes things cleaner, more standard and rely less on javascript.

The only caveat is a 1 pixel bug in Safari/Chrome/IE7, but i have hope we can fix this.
It is related to the way these browsers compute ems sizes.

Screenshots are attached :
- All browsers compared in their default text size.
- All browsers compared when text is zoomed.
- A screenshot before this patch when zooming text.

Edit : I removed the drop shadow to make it easier to see.

seutje’s picture

quick looksie didn't throw any red flags for me

favorite part is definitely

-  font: normal 0.9em "Lucida Grande", Verdana, sans-serif;
+  font: normal .9em "Lucida Grande", Verdana, sans-serif;

:P

that screenshot before patch is with JS enabled, right? coz otherwise the em padding-top on the body should scale along with the rest
with js enabled, I could imagine it wouldn't, as the event to resize it isn't triggered by text-zoom

will do a proper review & test in the morning, but I don't think I'll bump into anything, kudo's!

jide’s picture

FileSize
3 KB

Hehe, that was the easy part ;)

Yes, the screenshot of the previous behavior is with JS enabled.

Here is a new patch that gives us best of both worlds :

- Without javascript enabled, it behaves as in #10, so on some browsers, the top padding may be 1 or 2 pixels too high.
- With javascript enabled, instead of setting the top padding of the body to the toolbar height, we set the min-height of the toolbar to the top padding of the body. The pixel glitches in some browsers will be fixed and we still keep text-resizing working as expected.

webchick’s picture

Hm. I remember there was a lot of discussion back and forth in the original toolbar issue about CSS vs. JS approach to the toolbar and it was after all of that deliberation that the current approach was taken.

It'd be nice to get sign-off on this new approach from some of the people who were active on that patch (sun, Gábor, ksenzee, etc.)

Btw, welcome to the core team, jide. :)

jide’s picture

FileSize
3.28 KB

As you can see, I came late on all this, so I admit I did not digg in all issues, but maybe it helps to have a fresh look ;)
Would be useful to have other's opinions though.

This last patch for today fixes one last issue, adjusting the min-height of div.toolbar-menu also to fit the parent div. Not very elegant, but for now, it will do.

Thank you webchick, that's an honor :)

Dries’s picture

Technically, ems would be better (e.g. for accessibility) so I'm in support of this patch. I've pinged Gabor and ksenzee to see if they have something to add.

seutje’s picture

looks good, one slight issue though

it seems like chrome borks on this:

+  $('#toolbar').css('min-height', $('body').css('padding-top'));

but only when zoomed

-> http://jsfiddle.net/2MVSp/1/
if I zoom FF and chrome to the same level (chrome: http://gyazo.com/11b88a18782abb38b4b165f283190a4e.png FF: http://gyazo.com/8ddcd112103fd1bad7c25e69c11e24fa.png), then FF returns 69.1167px where chrome returns 119px, and it looks like it isn't jquery's fault, coz in the computed style for the padding-top, chrome does indeed say it's 119px. This appears to be incorrect, as setting the top bit's height to the computed value of the body's padding top causes overlapping in chrome -> http://gyazo.com/740fedc925a45954b9ec40fdd8331317.png

safari seems to handle it fine though, so it's prolly a chrome bug
if some1 could hit up http://jsfiddle.net/VdyJ8/ in chrome and zoom a couple times to confirm this behaviour isn't just my chrome

jide’s picture

@seutje : Interesting. I have the same results, when text is zoomed, Chrome does not seem to return the correct value... strangely, Safari does, though.

There is still a little issue with this patch :

When loading the page with an already set zoom-in and then zooming out, the toolbar does not scale down. This is because we set the min-height the first time the toolbar is displayed.

What we can do :

- Let this as is and consider it as a reasonable tradeoff.
- Do not bother to adjust the toolbar to a pixel perfect height with javascript for buggy browsers at all and live with some extra pixels.
- Consider a maximum toolbar height under which we do resize the toolbar using javascript, otherwise, do not resize it. This could be a min-height value set in CSS to let themers control it.
- Use a timer to check for the toolbar height regularly and adjust the height of the toolbar when text is zoomed in and out. But I guess this has already been considered, so there may be a reason it was not done.

What do you think ?

The more I dig in this issue, the more I understand what others might have been through ;)

jide’s picture

FileSize
3.69 KB

I implemented the setInterval solution and it works pretty well.
Everything works as expected and it feels cleaner.

See attached patch.

jide’s picture

FileSize
3.52 KB

Forgot to remove the display:none I added to hide the shadow.

Gábor Hojtsy’s picture

On em vs. px, most (all?) modern browsers can/will scale sizes regardless of them being provided in px or em.

Not sure about the time interval based checking though. This was known to cause performance problems in other cases, where the size of the overlay for example was attempted to be adjusted this way.

jide’s picture

Using pixels would definitely be simpler. Personally, I don't care if text zooming is not supported in IE6.
I am not very fond of the interval based thing too, this patch was proposed as a proof of concept, although I did not notice performance issues with it.

The only problem is that if we do not want to use pixel-sized fonts for the toolbar (see #668280: Toolbar font size keeps jumping around), we need to fix the toolbar height/padding with ems too.

Using pixels only for the toolbar font and height would be a lot easier, it would have a consistent look across themes, it would remove the need of resizing handling in toolbar.js and let us have a pure CSS solution. The only tradeoff being no text zoom support in IE6. So this is my favorite solution, but depends on what is decided in that other issue.

Otherwise, we could use one of the other solutions I proposed in #17, that is if we want to support a decent text zoom.

seutje’s picture

I'm not too keen on the interval either, and I think we can bring down the js to handle wrapping only (like http://gyazo.com/166c535b0a088a63f754da2e4e803cbe.png)

if all the heights in the toolbar are a relative height, then the entire toolbar is equal to the sum of those, but there are some paddings in px and the container doesn't have an explicit width, so there is no relative value we can give to the padding-top of the body that would exactly match that

so either we put everything in the toolbar in relative heights
or we put an explicit relative height value on the wrappers

and then we can put a timer on the resize event so 200ms after the user quit resizing, the padding-top of the body is set to the total height of the toolbar, in case wrapping occurred

jide’s picture

so either we put everything in the toolbar in relative heights

The patch already fixes every height, padding top / bottom and font size values in ems, so we are able to have its exact height in ems and set the top padding. Or did I misunderstand what you mean ?

or we put an explicit relative height value on the wrappers

I am not really sure about what you mean here ? Using a height value to prevent wrapping to occur ?

So in the end, we should stick to the patch behavior : have a minimal CSS solution (toolbar in ems or in pixels), fix the top padding in CSS for the most common scenario (toolbar is not wrapping) and fallback to JS if it is enabled to adjust toolbar height.

Edit : and decide what method to use for JS (see the alternatives in comment #17).

I am not aware of a way to listen to text resizing events in JS, that's why we use a setInterval method. Otherwise we could have used the event directly to resize the toolbar I guess. Ultimately, we could have a setInterval and compare the toolbar value each time the function is called and resize it only if it is different from the last set size. But I am not sure it would be more CPU friendly.... Or did I misunderstand again ? (Sorry again if it is the case !).

seutje’s picture

how's this? attempts to equalize the padding-top of the body to the height of the toolbar (instead of the other way around) on the resize event, with a timer to avoid certain browsers for throwing this like 20 000 time in a second

also, the use of .height() opposed to .css('height') fixes the chrome issue

should work relatively well without JS, only reason for the js is to handle wrapping, which is seems to handle pretty well

jide’s picture

Status: Needs review » Needs work
+    // Equalize body paddingTop on resize
+    // We use a timeout because some browsers fire a ton of these
+    var resizeTimeout = setTimeout(Drupal.toolbar.adjustHeight, 500);
+
+    $(window).resize(function() {
+      clearTimeout(resizeTimeout);
+      resizeTimeout = setTimeout(Drupal.toolbar.adjustHeight, 500);
+    });

We do not want to resize the toolbar on window resize, but rather when text zooming, or both, but setInterval made this unnecessary.
Could be nice if we don't go for setInterval though.

how's this? attempts to equalize the padding-top of the body to the height of the toolbar

That was the approach of the previous patch, wasn't it ?

also, the use of .height() opposed to .css('height') fixes the chrome issue

Nice catch.

We should decide how to handle text zooming as stated in #17 and go for it with the height() workaround.

jide’s picture

how's this? attempts to equalize the padding-top of the body to the height of the toolbar
That was the approach of the previous patch, wasn't it ?

Uh, sorry, I get it now.

No, this won't work because the whole point of this is to make text zooming work while keeping the toolbar height stick to the top area of the viewport.
Setting the top padding will fix this so it won't scale properly.

jide’s picture

Consequently, the height() trick is unuseful.
Moreover, although I had the same erroneous values for top padding as you with Chrome/Safari, it is not a problem since we set the value and not retrieve it, and in this case it works fine.

Edit : So for me patch in #19 still stands, unless we decide to use a different approach from #17 for handling text zooming (or not handling it).

jide’s picture

FileSize
3.52 KB

Sorry for the bunch of comments here.

I reattach patch from #19 and set this back to CNR to get more feedback and performance review.

I think performance problems raised by the overlay using setInterval would not occur here since the toolbar isn't the overlay, much simpler and straightforward.

So still waiting for a decision regarding #17 here.

seutje’s picture

err, resize handler is getting thrown on zoom for me, which isn't even necessary since it only really does anything (aside from setting the value to what it already is) when the items start wrapping

imo interval isn't an option

the issue was never an issue in safari, just chrome

why ur setting a min-height on the toolbar rather than a padding on the body is entirely beyond me, it's like ur inviting it to overlap

text-zooming is not only broken in IE6, it works the same in IE7 and 8

I tested #24 in safari 4.0.3, chrome 4.0, IE6, IE7, IE8 and FF 3.5.7, I got consisitent, usable behaviour in all of them, xcept when js is off and the item wrap

so... which browser gave which unexpected behaviour for u?

jide’s picture

Yes it does, some browsers do not accurately convert ems to pixels, (e.g. Safari and Chrome) so the toolbar height has 1 or 2 pixels missing. See the comments and screenshots above.

That is why I tried to address this using javascript.

imo interval isn't an option

As I explained, I'm not fond of it neither, but if it does not have performance issues, why wouldn't it be (at least) an option ? Otherwise, we could choose one of the other options. Anyway, any alternative from #17 is better than current behavior I think.

why ur setting a min-height on the toolbar rather than a padding on the body is entirely beyond me, it's like ur inviting it to overlap

I tested #24 in safari 4.0.3, chrome 4.0, IE6, IE7, IE8 and FF 3.5.7, I got consisitent, usable behaviour in all of them, xcept when js is off and the item wrap

Try text zooming with the patch and without, or with your last one. You will see the toolbar overlaps the top of the page. See previous screenshots.
The baddest thing is that when JS is enabled, you get a worse behavior than with it : without JS, toolbar resizes (almost) well, with JS adjusting top padding, it overlaps the page.

text-zooming is not only broken in IE6, it works the same in IE7 and 8

You mean... without patch applied ?

Edit : I guess you meant in general, so yes, as long as pixels are involved.

so... which browser gave which unexpected behaviour for u?

See screenshots in #10, everything is summarized there.

jide’s picture

err, resize handler is getting thrown on zoom for me

I tried :

    $(window).resize(function() {
      console.log('resize');
      clearTimeout(resizeTimeout);
      resizeTimeout = setTimeout(Drupal.toolbar.adjustHeight, 500);
    });

And did not get any output in the console when zooming text, on Safari and Firefox on Mac, but got output when effectively resizing the window.

jide’s picture

Tagging.

jide’s picture

Status: Needs work » Needs review

I thought I put it back to CNR, but doesn't seem so, and would be nice to have some more opinions.

seutje’s picture

odd, I had some1 test it on ff, sf and chrome on a mac and he said the event were firing when zooming

however, when testing again on safari on windows, it did not seem to fire, guess a coincidental scrollbar must of triggered it the first time, which indeed leads to worse behaviour than before

after muddling around for a while, it appears safari for windows doesn't throw any event at all when zooming

I feel inclined to propose dropping the js and live with imperfect wrapping

seutje’s picture

or how about converting it back to ems?

this seems to keep safari happy

jide’s picture

Title: Fix toolbar height with CSS » Fix toolbar height with CSS and make text zoom usable

or how about converting it back to ems?

But... It is already in ems in all patches I submitted and no, it does not make Safari / Chrome happy, there is still a 1-2 px quirk.
When toolbar is collapsed, there are chances that the size fits perfectly, but try with toolbar expanded or a different theme or with a different base body font size, it may fail (Firefox seems perfect, but IE < 8 and Safari/Chrome aren't).

About the resize event, I made some more tests :

Windows :
- Firefox : triggers resize event on text zoom
- IE : does not

Mac OS X :
- Firefox : does not (wtf ??)
- Safari : does not
- Chrome : does work !!

I'd bet Chrome on windows does trigger the event too, but did not test. Err, that's so weird !

@seutje : I admit I was skeptic about the resize event being fired under Windows, but testing confirms your affirmations.

So I don't think it can be a reliable event. Or we could handle exceptions, but I'm afraid it would be hard.
Too bad, it would have been a perfect solution...

Devil is always in the details ;)

I leave the issue as CNR since the #19 patch addresses all bugs, but at the price of a setInterval and #34 gives a less robust but CSS only solution.
Updated the title to reflect the last discussions.

The questions all this thread tries to answer (for newcomers eventually) :

- Do we want the toolbar height fixed in px or in ems ? Ems would be essentially to support IE text zooming.
- If we go for ems, there may be some added pixels to the top padding of the page and top padding may not follow toolbar height when window is resized. Is that bad ?
- If this is bad, we need to adjust the top padding using JS.
- As we need to listen to text resizing and since the "resize" event does not fire properly in all browsers, we can't rely on it to resize the toolbar, so another solution from #17 may be considered as a reasonable tradeoff. Or we could support only browsers that fire the "resize" event. But that would be sad.

Edit : updated summary to reflect problems with toolbar wrapping.

mcrittenden’s picture

Title: Fix toolbar height with CSS and make text zoom usable » Fix toolbar height with CSS

Sub.

mcrittenden’s picture

Title: Fix toolbar height with CSS » Fix toolbar height with CSS and make text zoom usable
seutje’s picture

I was referring to

+Drupal.toolbar.adjustHeight = function() {
+  $('body').css('padding-top', Drupal.toolbar.height()/12 + 'em');
+};

opposed to

+Drupal.toolbar.adjustHeight = function() {
+  $('body').css('padding-top', Drupal.toolbar.height() + 'px');
+};

so it doesn't set the initial values in px, ruining it if the resize event doesn't fire

I intentionally made sure to create a gap, as this beats overlapping

and I'm pretty sure resize fires on zoom in IE, u sure u didn't just not have a console? u can try here without one
but that doesn't rly matter anymore, the resize doesn't need to fire on zoom as it isn't setting it to px values anymore

jide’s picture

Ok, I understand better now.
But what does the "12" value would correspond to ?
Sounds fragile. This would vary in function of the theme and style, and I'm not sure we can compute this in case of inheritance, but maybe I'm missing something here ?

seutje’s picture

hmm yea, guess we should divide by $('body').css('fontSize') instead of flat out 12

jide’s picture

Status: Needs review » Needs work

That's a cool patch ! I'm totally convinced by this approach finally.
The toolbar height would remain unchanged and the top padding be adjusted while keeping its height in ems.
Great !

But I found a nasty bug in jQuery :

Adding an alert to debug roughly in IE,

Drupal.toolbar.adjustHeight = function() {
  alert($('body').css('fontSize'));
  $('body').css('padding-top', Drupal.toolbar.height()/parseFloat($('body').css('fontSize')) + 'em');
};

Will return a totally irrelevant number.

Issue on jQuery bug tracker : http://dev.jquery.com/ticket/760.
I used the proof of concept patch and it addresses the issue.

Issue has been fixed, but in version 1.4, so I think we should wait for #653580: Upgrade to jQuery 1.4 to see if it goes in.
If it does, this patch will be great !

Just one little thing :

+    var resizeTimeout = setTimeout(Drupal.toolbar.adjustHeight, 500);

Do we need to fire the timeout in the first place ?
Since the init function always fires collapse or expand, which both fire adjustHeight, it is not useful I think.

Otherwise great work, let's hope jQuery 1.4 gets in !

webchick’s picture

The plan is for jQuery 1.4 to go in, but it's currently blocked on jQuery UI 1.8. Oh, dependencies of dependencies of dependencies...

I'm a little confused. Is the only blocking issue for this that IE6's output looks a little weird, and this gets fixed in 1.4? If so, I see no reason not to commit it now, as long as it passes reviews. But if it's more serious than that, we can block it until later.

jide’s picture

It's more serious than that, toolbar will completely overlap the top of the page in all versions of IE because of this jQuery bug.
So unless it is okay to have a broken UI in IE, I am afraid we cannot commit this now.

Or we could let the JS resizing bit apart for now and submit a new patch when jQuery is updated to 1.4.

With either solution, we could update the patch in #535066: Use CSS3 / IE filter to render toolbar shadow and get rid of the IE trick in there (Yeah dependencies again... ;) ).

jide’s picture

Hmmm... I realize we'll probably still need the IE trick anyway since we use height(), forget my last sentence.

catch’s picture

Yeah if IE6 looks dodgy and we expect a fix, let's commit now and open an issue to review once jQuery 1.4 gets in. IE6 shouldn't hold up improvements to other browsers as long as it's not completely broken by them.

seutje’s picture

ugh, we just can't catch a break with these weird bugs, can we? q.q

webchick’s picture

Unfortunately, we definitely can't commit patches that break all versions of IE, though.

Stupid IE.

I shake my fist at you! *shake shake*

jide’s picture

So what about committing CSS fixes only in the meanwhile ?
It's just about a few extra pixels on some browsers and would be better than current behavior anyway.

jide’s picture

I tested patch #41 in Konqueror and it works fine !

jide’s picture

Status: Needs work » Needs review
FileSize
3.68 KB
2.87 KB

Here are 2 patches :

- 698976-toolbar-height-51-CSS.patch :
CSS only solution that could be committed now.

- 698976-toolbar-height-51-CSS-and-JS.patch :
CSS and JS fallback that could be committed when jQuery 1.4 is implemented.

Note that I made a few changes :

- 698976-toolbar-height-51-CSS.patch :
Back to exact ems height instead of playing with subpixel values. So instead of :

body.toolbar {
  padding-top: 2.545em;
}

body.toolbar-drawer {
  padding-top: 5.52em;
}

We have :

body.toolbar {
  padding-top: 2.52em;
}

body.toolbar-drawer {
  padding-top: 5.49em;
}

That was made as an attempt to make Safari and Chrome more accurate, but won't be needed if JS version goes in and having exact values is safer in the end.

- 698976-toolbar-height-51-CSS-and-JS.patch :
Remove first call to setTimeout(Drupal.toolbar.adjustHeight, 500);
Used outerHeight() instead of height() in Drupal.toolbar.height() to be safer. One could add a border to the toolbar.

seutje’s picture

Back to exact ems height instead of playing with subpixel values.
That was made as an attempt to make Safari and Chrome more accurate, but won't be needed if JS version goes in and having exact values is safer in the end.

I don't really see how those are "exact" values, and I didn't change them to make safari and chrome more accurate, I changed them after comparing the computed values
using 5.49: toolbar computed height - body top-padding computed
using 5.52: toolbar computed height - body top-padding computed

either way, it's going to end up being a subpixel value, I was mearly attempting to make it accurate

jide’s picture

In fact I thought it was me who changed those values.

These values are "exact" means that it is the em size I got by adding line-height + padding :

#toolbar div.toolbar-menu :
[element height] (1.8em + .5em + .5em) * [font-size] 0.9em = 2.52em;

#toolbar a#edit-shortcuts :
[element height] (2.3em + .5em + .5em) * [font-size] 0.9em = 2.97em;

So the total height of the expanded toolbar is 2.52 + 2.97 = 5,49em.

Anyway, comparing with computed values makes no sense IMHO, since if body font size changes, then computed values will change too, so we cannot be sure how this will be converted to pixels.

I think we should let the browser convert ems to pixels, leaving sub-pixel values as they are, I did not mean to avoid them but the opposite.

Btw, your comment's "using 5.49: toolbar computed height" and "using 5.52: toolbar computed height" point to the same image.

Agreed to other changes in the patch with JS ?

seutje’s picture

Btw, your comment's "using 5.49: toolbar computed height" and "using 5.52: toolbar computed height" point to the same image.

that's coz they are the same, changing top-padding on the body doesn't affect the height of the toolbar :P

jide’s picture

Oh, of course ;)

jide’s picture

Other than that, agree with the other things ?

seutje’s picture

yea sure, the outerHeight makes more sense

mgifford’s picture

I'm so bad at checking the 'needs accessibility review' tag

Thanks to the link to it from #668280: Toolbar font size keeps jumping around

amc’s picture

Issue tags: +Needs usability review

correcting tag

casey’s picture

retester2010’s picture

Status: Needs review » Needs work
Issue tags: +Needs usability review, +Needs accessibility review

The last submitted patch, 698976-toolbar-height-51-CSS-and-JS.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
2.87 KB

Ok, so for core now the best we can do is 698976-toolbar-height-51-CSS.patch right? I wonder if the bot is getting confused by the two tests.

In anycase, I applied it and there were problems with both toolbar.css & toolbar.js

@jide can you re-roll this patch?

jide’s picture

@mgifford : I'm totally over busy right now, but I'll try to give it a shot tonight.

Status: Needs review » Needs work

The last submitted patch, 698976-toolbar-height-51-CSS.patch, failed testing.

jide’s picture

The (brilliant) patch from #668280: Toolbar font size keeps jumping around implied some changes in the calculation of the toolbar height :

#toolbar div.toolbar-menu :
[element height] (1.8em + .5em + .5em) * [font-size] 0.9em = 2.52em;

#toolbar a#edit-shortcuts :
[element height] (2.3em + .5em + .5em) * [font-size] 0.9em = 2.97em;

So the total height of the expanded toolbar is 2.52 + 2.97 = 5,49em.

Since the toolbar font is not em based anymore, we do not have to multiply by the font size anymore.

Here is a re-rolled patch for latest CVS, but this time it is a pure CSS patch, no change has been made to the javascript bits, since it was here because of the font size, and moreover the approach taken in #787940: Generic approach for position:fixed elements like Toolbar, tableHeader will probably change this part in the future (I did not dig too much there, but if I understand correctly).

I did not have time to test the patch very well though.

jide’s picture

Status: Needs work » Needs review

Whoops, status, status...

mgifford’s picture

FileSize
78.8 KB
84.41 KB

The bot and I both agree that the new patch applies well.

I've got screenshots now of the toolbar before-after for comparison.

The effects of this patch are visible with javascript enabled.

It looks like this patch addresses this issue.

jide’s picture

@mgifford : you meant "The effects of this patch are visible without javascript enabled.", right ?

mgifford’s picture

@jide - yup.. without javascript.. Sorry.

jide’s picture

Oh okay, no problem.

mgifford’s picture

mgifford’s picture

mgifford’s picture

I thought about marking this RTBC, but I'd really want to have someone else look over the implications of this change. For accessibility the change sounds great. I'm worried about it affecting something else though

Maybe @Bohjan can comment on this.

Everett Zufelt’s picture

Component: toolbar.module » CSS
Issue tags: +Needs issue summary update
Bojhan’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: -Needs usability review, -Needs accessibility review

I am not sure what to review, it doesn't change anything visually?

jide’s picture

@Bojhan: Without the patch, and with JS disabled, the toolbar leaves too much room at the top of the page. With patch applied, still no JS, it should leave exactly enough room for the toolbar, and when using text-zoom in the browser this should still be true.

xjm’s picture

Status: Needs review » Needs work
Issue tags: +Novice, +Needs manual testing

Thanks for your work on this; this definitely seems like an accessibility improvement. Since this is a frontend change, we'll want some manual testing in several browsers.

Note that the Drupal 8.x patch will need to be rerolled, because the core directory structure for Drupal 8 has now changed. (For more information, see #22336: Move all core Drupal files under a /core folder to improve usability and upgrades). When the patch has been rerolled, please set the issue back to "Needs Review."

Tagging as novice for the task of rerolling the Drupal 8.x patch.

cosmicdreams’s picture

ah, my favorite tag: needs manual testing.

Looks like I'll have to reroll the patch in order to get going.

Can you please state which manual tests you want me to do. (sorry haven't read through all the posts.

xjm’s picture

Issue tags: +Needs backport to D7

There are a couple things to test in multiple browsers. This is backportable, so I'd say test in IE 6+, FF 3+, etc. It sounds like the patch should be tested with JS enabled and disabled.

  1. Test to verify the fix in the following screenshots is applied in each browser:

    Before:

    http://drupal.org/files/issues/screen-capture-1_1_0.png

    After:

    http://drupal.org/files/issues/screen-capture-2_5.png

    Edit: Wow, sorry, those screenshots are huge. I'll just insert links instead. :P

  2. Test zooming in and out in each browser and verify that the toolbar is rendered properly upon zoom.
  3. Verify that the patch doesn't have unintended side effects.
jide’s picture

Also see comment #77.

jibran’s picture

Status: Needs work » Needs review
FileSize
1.26 KB

reroll as per #78

xcafebabe’s picture

Issue summary: View changes

An issue summary to create a concise overview of this old CSS issue on toolbar.

xcafebabe’s picture

FileSize
1.26 KB

Patch in comment #82 does not work as expected with JS disabled (Firefox 14.0.1 & Chrome 18.0.1025.168 (Developer Build 134367 Linux))

The math calculation for padding-top in body.toolbar-drawer (read comment #66) is not correctly set.

I made this change and it worked as expected. All credits to @jide

xcafebabe’s picture

Issue summary: View changes

Changed some misspelling words

frob’s picture

FileSize
1.26 KB

Re-rolled the the patch to work with the current css files.

mike stewart’s picture

Status: Needs review » Needs work
FileSize
96.97 KB

#84 re-roll Patch applies cleanly. and testing on FF14 works as expected.

Testing fails on Bartik in Chome Win & Chromium Ubuntu with JS disabled. (bummer) Note: whitespace between grey (shortcut toolbar) and blue header.

mike stewart’s picture

Issue summary: View changes

Changed path to review and test

xjm’s picture

An issue summary was added by @xcafebabe during the DrupalCon Munich core mentoring sprint. I updated the summary to add @mike stewart's observations from #85 (that the current patch has a bug) and also to document explicit manual testing instructions.

xjm’s picture

Issue summary: View changes

Updated issue summary.

mgifford’s picture

Status: Needs work » Closed (fixed)

With the new toolbar, I think this is fixed. Please re-open if I'm wrong.

David_Rothstein’s picture

Version: 8.x-dev » 7.x-dev
Status: Closed (fixed) » Needs work

Not 100% sure about Drupal 8, but I doubt this ever got fixed in Drupal 7. Reopening it for that, at least.

frob’s picture

Version: 7.x-dev » 8.x-dev
FileSize
58.01 KB

I haven't tested to see if the problem still exists in 8. Seeing as how this issue was never resolved and the new toolbar can still be pinned to the top of the page. I am putting it back on 8.

If anyone tests this on 8 and sees that it isn't fixed, then please put back onto 7.x.

Edit** I have tested this is d8, and it is even worse.

Screen shot 2013-04-24 at 12.18.37 AM.png

frob’s picture

Issue summary: View changes

Updated issue summary.

Manjit.Singh’s picture

84: 698976-84.patch queued for re-testing.

The last submitted patch, 84: 698976-84.patch, failed testing.

emma.maria’s picture

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

Version: 8.x-dev » 7.x-dev

Testing on fresh D8, JS off, on Bartik, Stark and Seven:
Chrome: no whitespace. Zooming works.
Firefox: no whitespace at any time.
IE: ditto.
Safari: ditto.

Also short.module.css has changed significantly since this patch was last checked. Marking this back to D7, probably needs to be retested there.

mgifford’s picture

@ekl1773 - Why did this change to D7?

ekl1773’s picture

@mgifford- I was going off of comment #88. The problem is gone in D8 but might still be present in D7. Perhaps I haven't completely understood the history here?

mgifford’s picture

Version: 7.x-dev » 8.x-dev

I'm pretty sure that this still needs to be tested in Drupal 8 and then backported to D7.

Have you tested the patch in #92 in SimplyTest.me?

frob’s picture

Version: 8.x-dev » 7.x-dev
Status: Needs review » Needs work

I tested #92 against 8.x dev. It doesn't apply.

With that said, the whole toolbar has been changed in D8, this issue had to do with the old toolbar in D7.

The core of the issue no longer applies in D8.

R13ose’s picture

Status: Needs work » Needs review

I have tested this in Chrome and the white space for the toolbar without Javascript enabled is still there in 7.42-dev.

From using Seven and Bartik themes, there is a difference in the amount of space between the toolbar and the header. I figured that this css is the problem: body.toolbar-drawer { padding-top: 5.3em; }. This needs to be reviewed again in 7.x.-dev.

The patch in #92 seems to be designed for 8.x-dev which from the comments seems to be working correctly.

cilefen’s picture

Status: Needs review » Needs work

This needs work until there is an applicable Drupal 7 patch.

priya.chat’s picture

Assigned: Unassigned » priya.chat
brahmjeet789’s picture

Please check this patch i have checked in my chrome and firefox browser but it works correctly.

brahmjeet789’s picture

brahmjeet789’s picture

Status: Needs work » Needs review
snehi’s picture

@Brahm thanks for the patch but please add one patch with all the mention pointers.
Always add interdiff it will be easy for reviewer to review the patch.
Thanks for your contribution.
How to create interdiff please follow this https://www.drupal.org/documentation/git/interdiff

brahmjeet789’s picture

Thanks @snehi , i will keep in mind while adding the patch to create an interdiff.

priya.chat’s picture

Assigned: priya.chat » Unassigned
R13ose’s picture

I reviewed the patch, and the css for the icons shortcut.png and toolbar.png are showing more then 1 icon within div.add-or-remove-shortcuts a span.icon, #toolbar div.toolbar-menu a.toggle, and
#toolbar div.toolbar-menu ul li a.active:hover,
#toolbar div.toolbar-menu ul li a.active:active,
#toolbar div.toolbar-menu ul li a.active,
#toolbar div.toolbar-menu ul li.active-trail a.

Besides all of that, the patch seems to be working for me at the moment to remove the space.

brahmjeet789’s picture

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

Status: Reviewed & tested by the community » Needs work

Needs work to address #108.

Also please prove there are no regressions with screenshots. Thanks!

stefan.r’s picture

Issue tags: +Dublin2016, +Needs screenshots

Tagging as a novice task for #108 and 110