Page MenuHomePhabricator

Header spacing is broken in the mobile web
Closed, ResolvedPublic

Assigned To
Authored By
Jhernandez
Jan 4 2018, 11:36 AM
Referenced Files
F13780605: image.png
Feb 15 2018, 10:40 PM
F13780600: image.png
Feb 15 2018, 10:40 PM
F13780598: image.png
Feb 15 2018, 10:40 PM
F13780602: image.png
Feb 15 2018, 10:40 PM
F13780596: image.png
Feb 15 2018, 10:40 PM
F13780594: image.png
Feb 15 2018, 10:40 PM
F13741181: Screen Shot 2018-02-14 at 15.56.31 1.png
Feb 14 2018, 3:01 PM
F13316941: image.png
Feb 8 2018, 7:29 PM
Tokens
"Like" token, awarded by Volker_E."Love" token, awarded by Jhernandez.

Description

The spacing on the header of wikipedia.org is broken:

  • it is non existent
  • the header elements positioning is inconsistent across browsers

See attached files:

  • Android 8, Chrome

Screenshot_20171217-111713.png (2×1 px, 277 KB)

  • Android 8, Firefox

Screenshot_20171217-111718.png (2×1 px, 249 KB)

Design

  1. We need to keep the globe and the wordmark close to each other, as one unit
  2. center align this one unit
  3. offset it to the left by 10px/pt to optically center align it

iPhone 8 Copy.png (1×750 px, 196 KB)

Expected final result

iPhone 8.png (1×750 px, 195 KB)

Paddings

  • 25px/pt top and bottom of the unit
  • center align the unit with -10px offset to the left
  • 10px/pt between the globe and the wordmark
  • total max-width of the unit 210px on mobile
  • should be consistent across browsers
  • none of this applies to desktop

QA

A staging environment is available at http://tools-static.wmflabs.org/www-portal-staging/wikipedia.org/ to verify the changes meet the design criteria. There is no interaction required to test these changes, but they should not break layout on any supported mobile devices.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
ovasileva triaged this task as Medium priority.Jan 9 2018, 4:12 AM
ovasileva added a project: Web-Team-Backlog.

as all things here... not as easy as it appears.

In order to accomodate the desktop site, the wordmark and globe logo are structuraly seperated in the HTML (i.e. they don't have a common parent element that could be used to group and center them together). See screenshot.

Screen Shot 2018-01-11 at 11.00.47 AM.png (452×1 px, 207 KB)

The globe logo is positioned aboslutely so that it appears beside the wordmark. It's default DOM position is below the wordmark (default being desktop). Changing the markup to group the two together would require reworking the layout substantially, and it would probably lead to a lot of complications on desktop.

However, here's another idea...

Let's get rid of the globe logo on mobile all together
Rationale:

  • The globe logo, at the small size it appears on mobile, looses much of its detail
  • To acommodate rtl and ltr languages, the wordmark and subhead "the free encyclopedia" are centered. Having the logo to the left of the wordmark, even as it is now, seems ltr specific
  • With the logo and subhead centered (for the reason mentioned above), putting the logo to either side introduces multiple alignments to the header: the logo and subhead are centered, the logo is left-algined, but then the whole unit is centered. Mixing alignments like this is visually inconsistent
  • this would remove some CSS that's responsible for very small sizes, when the logo and wordmark collide.

So...

Screen Shot 2018-01-11 at 12.17.38 PM.png (439×367 px, 39 KB)

?

You can also have two logos and use media query with widths to determine which of the two is shown ?

@TheDJ that's true, we could use a seperate image that contains the logo + wordmark for mobile.
In that scenario however, we wouldn't be able to localize the "free encyclopedia" subheading, unless we create ~300 localized images (maybe an option?).
If we remove the subheading, that would actually bring the logo in line with recommended Wikipedia brand guidelines (see "horizontal version"), but I feel like then we would lose some of the multilinguage spirit of the page.

Changing the markup to group the two together would require reworking the layout substantially, and it would probably lead to a lot of complications on desktop.

That might have been an overreaction. The desktop version places the logo with "relative" positioning, and the mobile version uses "absolute" positioning. The desired change could be achieved by flipping this behaviour, having the logo use absolute positioning on desktop and relative positioning on mobile.

I'm working on a patch in this direction, and it's looking doable. After some investigation, using absolute positioning for the logo on desktop won't be as big a change as I assumed, since the top-ten links also use absolute positioning, so their layout will be un-effected.

Change 404438 had a related patch set uploaded (by Jdrewniak; owner: Jdrewniak):
[wikimedia/portals@master] Updating header for mobile

https://gerrit.wikimedia.org/r/404438

I came up with a solution that I think addresses the issue pretty well. The spacing matches the design, and the patch also accommodates RTL languages and long subheading ("free enclyclopedia") lengths.

design to patch diff (on iOS simulator)

Screen Shot 2018-01-16 at 1.34.04 PM.png (327×545 px, 79 KB)

Language variants

Screen Shot 2018-01-16 at 12.48.59 PM.png (411×394 px, 48 KB)
Screen Shot 2018-01-16 at 12.49.22 PM.png (418×396 px, 46 KB)
Screen Shot 2018-01-16 at 12.49.39 PM.png (423×397 px, 47 KB)
Screen Shot 2018-01-16 at 12.49.55 PM.png (416×397 px, 48 KB)
Screen Shot 2018-01-16 at 12.50.09 PM.png (478×398 px, 51 KB)

Testing on Android 2.3 & up (... and IE6, why not)

Screen Shot 2018-01-16 at 1.11.52 PM.png (609×320 px, 185 KB)
Screen Shot 2018-01-16 at 1.13.18 PM.png (687×369 px, 126 KB)
Screen Shot 2018-01-16 at 1.14.52 PM.png (604×381 px, 169 KB)
Screen Shot 2018-01-16 at 1.18.13 PM.png (650×826 px, 190 KB)
Jdlrobson subscribed.

Per standup jan is working on this so let's track/support him!

Screenshots look good to me.

Thanks Jan, this was super fast :)

portal.gif (454×418 px, 261 KB)

So I looked into this and thanks to contributing.md this was very easy to setup.
I've updated https://www.mediawiki.org/wiki/Wikipedia.org_Portal - more information about it would be great.

Post your change I'm seeing some strange behaviour in firefox, with hard refreshes - I see the text "Wikipedia logo" alt text and it's very large and there is a noticeable repaint! I don't see this before your change and there is definitely a reflow going on (in Chrome too) - seems to be font size related and is very distracting. Can we fix both those problems?

@Jdlrobson your right I noticed the firefox repaint - that must be their new rendering engine. It's probably because the logo image & alt text is in an H1. will fix.

Regarding @Jdlrobson's screenshot, I just went down a rabbit hole of Firefox FOUC. Here's what I found:

  1. more visible on the dev build: I assumed there was a greater chance of seeing FOUC on the dev version since the CSS is served as external files. This seems to be true. I didn't seen the FOUC when I ran the production build on this patch. For production, we inline the CSS into the index.html, so that we avoid making an extra http request and the styles are loaded as fast as possible.
  2. font-size issue: The FOUC in @Jdlrobson's screenshot was highly visible because the image with alt-text sits inside an <H1> which has big text by default. Since we can't depend on the stylesheet file to fix this, we can use an inline-style to set the font-size on the H1.
  3. Autofocus on Firefox: More interestingly, I found T181877 - Firefox displays FOUC when an input with autofocus is present. Amazingly, removing the autofocus="autofocus" attribute from the search input (found in the search.handlebars template) fixes the FOUC on Firefox (with the dev build) completely.

That last bug is wild, but luckily, it doesn't effect us since we inline the styles in production, which seems to avoid the autofocus issue. So, I think changing the font-size is enough to remedy the issue in this case.

Jdlrobson added a subscriber: ABorbaWMF.

@Jdrewniak can you update some QA instructions and pass this to @ABorbaWMF (not sure whether you need to deploy first or have a staging server)

Change 404438 merged by jenkins-bot:
[wikimedia/portals@master] Updating header for mobile

https://gerrit.wikimedia.org/r/404438

We talked in standup about getting a task set up to allow qaing the portal.

In the meantime jan is there some where we can host the static files on so Anthony can verify?

@ABorbaWMF I've updated the description with some QA instructions. The staging environment is available here, and all we really need to do is make sure it doesn't break layout (I've checked on some browserstack devices & looks fine to me).

Isn't the wordmark too close to the globe? The "T" is basically touching the globe.

Change 410456 had a related patch set uploaded (by Jdrewniak; owner: Jdrewniak):
[wikimedia/portals@master] Adjusting header alignment

https://gerrit.wikimedia.org/r/410456

yeah, must have gotten skewed during code-review, hope this patch looks better

Screen Shot 2018-02-14 at 15.56.31 1.png (671×381 px, 67 KB)

Change 410456 merged by jenkins-bot:
[wikimedia/portals@master] Adjusting header alignment

https://gerrit.wikimedia.org/r/410456

I've updated http://tools-static.wmflabs.org/www-portal-staging/wikipedia.org/ with the latest changes. @Nirzar since Anthony has already done cross-browser QA on this, if you think the spacing looks good than it should be ready for sign off.

yeah we can move this to needs sign off. looks good to me, i can resolve it.

  NODES
Idea 1
idea 1
Note 1
Project 4
Verify 2