Page MenuHomePhabricator

[Regression] Menu panel has black background when another drawer is first opened
Closed, ResolvedPublic3 Story Points

Description

Steps to Reproduce

  1. Visit the mobile site on the Minerva skin anonymously. E.g., https://en.m.wikipedia.org/wiki/Barack_Obama.
  2. Tap the menu button
  3. Dismiss menu and tap the star
  4. Dismiss and tap the menu button

Expected Results

  • Menu background is consistently drab

Actual Results

  • Menu background becomes bullet hole black

Environments Observed

  • enwiki prod

Browser Version

  • Chrome v71.0.3578.57

OS Version

  • Chrome OS v71.0.3578.57

Device Model

  • Pixel Slate

Device Language

  • English

Developer notes

This is a 7 month old regression added by T165535.

A has-drawer class is added to the body inside Drawer.prototype.postRender which is never removed.
It was added by https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MobileFrontend/+/431634/

To fix this, we'll want to add the class inside the show method and remove it via the hide method

There is also a good opportunistic refactor here, to attempt to resolve T209129 which may overlap quite nicely with this bug.

QA steps

  • Follow the replication steps on production to become familiar with this bug.
  • Please follow the replication steps but now do so on the test URI https://en.wikipedia.beta.wmflabs.org/
  • Please do some exploratory testing clicking the hamburger icon and the watch icon in different sequences to see if the error resurfaces under any circumstances.

Event Timeline

Restricted Application changed the subtype of this task from "Deadline" to "Task". · View Herald TranscriptDec 11 2018, 2:52 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdlrobson renamed this task from [Bug] Menu panel has black background when another drawer is first opened to [Regression] Menu panel has black background when another drawer is first opened.Dec 13 2018, 12:48 AM
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Needs Prioritization to Upcoming on the Readers-Web-Backlog board.
Jdlrobson added a project: Regression.

Change 482783 had a related patch set uploaded (by Jdrewniak; owner: Jdrewniak):
[mediawiki/extensions/MobileFrontend@master] Drawer.js DOM inserted onShowDrawer instead of on initialization

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

ovasileva set the point value for this task to 3.Jan 10 2019, 7:02 PM

Change 484776 had a related patch set uploaded (by Jdrewniak; owner: Jdrewniak):
[mediawiki/skins/MinervaNeue@master] Prevent black background from appearing on menu after clicking reference

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

Jdrewniak added a comment.EditedJan 16 2019, 10:03 PM

After looking through the code, I think the regression might have been caused by use moving modules around during the refactor, and causing some CSS files to be loaded in a different order.

Judging from these two rules, they have the same specificity and it looks like .primary-navigation-enabled' might have been responsible for overriding the .has-drawer rule with a different background color.

The patch above fixes that.

It does not solve the underlying issue that the Drawer appends a class to the HTML and never removes it, or that the Drawer DOM itself is never actually removed from the document after closing a drawer...

I think those underlaying issues are concerning but deserves their own ticket.

Change 484776 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Prevent black background from appearing on menu after clicking reference

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

phuedx reassigned this task from Jdrewniak to Edtadros.Jan 22 2019, 6:09 PM
phuedx added a subscriber: Jdrewniak.
phuedx added a subscriber: phuedx.

☝️ Per today's standup ritual.

@Jdrewniak looking through this again, specifically in the context of T214049 I really think we should also be updating Drawer.prototype.onHideDrawer to also remove the class has-drawer it adds in postRender. Patch to follow.

Change 485972 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Make Drawer's contract clearer

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

Jdrewniak added a comment.EditedJan 23 2019, 2:06 PM

I really think we should also be updating Drawer.prototype.onHideDrawer to also remove the class has-drawer it adds in postRender. Patch to follow.

I didn't want to touch the .has-drawer class because it's responsible for adding transitions to the overlay. But looking at your patch, it seems like we can still maintain those transitions, the only one I don't see is the opacity fade-out transition when the drawer closes.

Jdlrobson added a subscriber: Edtadros.

I didn't want to touch the .has-drawer class because it's responsible for adding transitions to the overlay. But looking at your patch, it seems like we can still maintain those transitions, the only one I don't see is the opacity fade-out transition when the drawer closes.

Looks like the issue might be with the minHideDelay which was considerably shorter than the time needed for the drawer CSS animation to finish. There are also some clashing CSS rules in /Users/jrobson/git/core/skins/MinervaNeue/skinStyles/mobile.startup/toast.less of all places... I can look into this tomorrow if you don't beat me to it.

.animations .drawer.visible,

I don't think the minHideDelay is used for animation. I think that's a hack to get around attaching the window.click event in the onShowDrawer method. In a previous patch (which I just slowly walked away from... ) I attempted to add another timer for the hide method. It's kind of brittle because I hard-coded the duration at 250ms, which is a value that's actually changed in CSS.

Anyway to your point about the rules in toast.less, I don't think those are clashing styles, I might be mistaken but I think those are the actual styles responsible for sliding the drawer in and out.

The styles responsible for fading the background in and out are actually in drawer.less:

// Darken the content to highlight the drawer.
.has-drawer {
	background-color: @colorGray1;

	> *:not( .drawer ) {
		opacity: 1;
		.transition( opacity .25s linear );
	}

	&.drawer-visible > *:not( .drawer ) {
		opacity: 0.6;
	}
}

So removing the .has-drawer class also removes the transition on > *:not( .drawer ) (i.e. everything on the page except .drawer).

I guess if we wanted to keep that transition we would have to create a class like

.animations > *:not( .drawer ) {
    .transition( opacity .25s linear );
}

But that still looks kind of weird because background color changes from grey to white.

Jdlrobson reassigned this task from Jdlrobson to Edtadros.Jan 24 2019, 6:40 PM
Jdlrobson updated the task description. (Show Details)

Change 485972 abandoned by Jdlrobson:
Make Drawer's contract clearer

Reason:
To be done on a different patch

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

I chatted with Jan after standup, and we agree that it makes sense to tackle further changes in a new task which I will flesh out today.

Edward please procede with QA

This passed with a ChromeOS virtual machine. I'm going to check it with an emulator that allows me to test with the same resolution as a Pixel Slate.

Edtadros reassigned this task from Edtadros to ovasileva.Jan 29 2019, 3:56 AM

Tested this with Chrome DevTools emulating the Pixel Slate resolution of 3000x2000 pixels in both landscape and portrait mode. The menu background did not become bullet hole black in either of those scenarios. Additionally, I tested the Galaxy S5, Pixel 2, Pixel 2XL, iPhone 6/7/8 (plus and non-plus), and the iPad Pro. They all worked.

ovasileva closed this task as Resolved.Jan 30 2019, 12:32 AM

Looks good, thanks @Edtadros!

ovasileva updated the task description. (Show Details)Jan 30 2019, 12:33 AM

Change 482783 abandoned by Jdlrobson:
Drawer.js DOM inserted onShowDrawer instead of on initialization

Reason:
Larger conversation continuing in https://gerrit.wikimedia.org/r/524314

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