Page MenuHomePhabricator

Vector should be notified by addPortletLink to collapsible where needed
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. Go to a page without the "More" dropdown tab, e.g. a main page of a wiki where you aren't a sysop.
  2. Decrease the size of the window to make sure that there is only a small gap between the left and the right tabs.
  3. Execute
mw.util.addPortletLink( 'p-cactions', '#',
	'My new portlet link', 'ca-my-portlet',	'Click here to test the new portlet'
);

Actual result:
The right tabs drop below and cover the main heading.

tabs-placement.png (900×727 px, 194 KB)

Expected result:
The "History" tab should be collapsed into the "More" dropdown. This happens when you force collapsible tabs to trigger by resizing the window a little bit.

Event Timeline

On the main page the collapse happens much later than it does on other articles. The tabs are overlapping the heading on the main page for me without even adding the new link.

both screenshots were taken without running the code in the task description

Main pageArticle
main.png (447×560 px, 109 KB)
article.png (444×684 px, 128 KB)
Jhernandez subscribed.

If I understand correctly the problem is that the tabs overlap content on thin windows, right? (Regardless of the snippet on the description)

Adding Design in case there's some input here.

If I understand correctly the problem is that the tabs overlap content on thin windows, right? (Regardless of the snippet on the description)

The problem is, that they overlap, even though everything would look fine if one tab gets collapsed as usual.

addPortletlink, should trigger an event, to signal that it has changed something, Vector's collapsible tabs should listen for that event in order to be able to recalculate if all tabs fit the available width (it already does this on window.onresize).

One option is just to have addportletlink trigger a window resize event, but since many things might be listening for that, that could create a little bit too much overhead ?

Krinkle renamed this task from In Vector, addPortletLink should trigger collapsible tabs to Vector should be notified by addPortletLink to collapsible where neeeded.Oct 9 2019, 4:26 PM
Krinkle subscribed.

Probably some custom DOM event on the specific portlet root could work. Somewhat similar to what we do in ajax.watch.js

Volker_E renamed this task from Vector should be notified by addPortletLink to collapsible where neeeded to Vector should be notified by addPortletLink to collapsible where needed.Oct 24 2019, 5:10 PM

Change 727618 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Vector should be notified by addPortletLink to collapsible where needed

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

Replication steps:

Visit https://en.wikipedia.org/wiki/Balinese_language?safemode=1&useskinversion=1 incognito window
Make sure no more menu and resize so it looks like this:

Screen Shot 2021-10-08 at 7.53.54 AM.png (482×1 px, 145 KB)

Run code in developer console

mw.util.addPortletLink( 'p-cactions', '#',
	'My new portlet link', 'ca-my-portlet',	'Click here to test the new portlet'
);

Actual:

Screen Shot 2021-10-08 at 7.54.16 AM.png (436×1 px, 142 KB)

Expected:

Screen Shot 2021-10-08 at 7.54.33 AM.png (466×1 px, 145 KB)

What happens here is that the calculation assumes that it should 'collapse' to the menu when the outside of Read hits/collides with the outside of talk. But because here the width between Talk and the Read tab is smaller than the width of the More menu, after inserting the Menu, the tabs have already overlapped, and the CSS forces it to the next line, which the calculation doesn't account for.

In the past the tabs couldn't drop to the next line and would simply overlap. This drop to the next line CSS was added to Vector much later, but the script wasn't updated to take this very specific situation into account.

Change 727618 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Vector should be notified by addPortletLink to collapsible where needed

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

Jdlrobson claimed this task.

please reopen if this issue still exists after next week's deploy.