Page MenuHomePhabricator

mw.util.addPortlet() dropdown menu has unexpected border and too much padding
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • open javascript console
  • type this and press enter:
mw.util.addPortlet('p-twinkle', 'TW', '#p-cactions');
mw.util.addPortletLink('p-twinkle', '#', 'Tag');
mw.util.addPortletLink('p-twinkle', '#', 'CSD');
mw.util.addPortletLink('p-twinkle', '#', 'XFD');

What happens?:

  • unexpected interior black border

image.png (761×219 px, 47 KB)

  • mw-list-item padding much greater than other elements in Vector 2022 skin

image.png (236×462 px, 14 KB)

  • bottom of dropdown list has too much padding

image.png (754×430 px, 80 KB)

What should have happened instead?:

  • no border
  • line height similar to other items in Vector 2022 skin
  • top and bottom padding of the dropdown menu should be identical, for symmetry (currently too much on top and bottom)

image.png (485×119 px, 9 KB)

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Looks like this can be fixed from the Twinkle side of things. Luckily I think it's a matter of just deleting these last two selectors: https://github.com/wikimedia-gadgets/twinkle/blob/master/twinkle.css#L46

Jdlrobson subscribed.

Hopefully now Twinkle is using addPortlet these kind of hot fixes wont be necessary going forward.

Yes, Twinkle was switched to mw.util.addPortlet :)

Thanks for the patch Jan. Will test and merge it later today.

MoreMenu has the same problematic hotfix code that needs to be deleted. I'll file a PR for that later today unless you get to it first.

https://github.com/wikimedia-gadgets/MoreMenu/blob/aa0ed9b53ebe1632d12d23f20d0f4c8f8098e39a/src/MoreMenu.js#L409-L415

I'm working on MoreMenu now. It's a bit different because it has custom HTML for the menu items, as well as the submenus. Just removing the hotfix CSS gives us this:

Screenshot from 2023-12-12 21-18-13.png (610×559 px, 62 KB)

which I think is worse than the way it looks now.

I hope to have this all fixed within the next few hours.

Looks much better. Thanks for the patch Jan.

Any chance we can fix the upper and lower padding with a patch to Vector? I think visually it would make the most sense if the padding in all 4 directions was 16px exactly. Right now there seems to be extra padding on the top (22px total), and extra padding and margin on the bottom (23.4px total). This is in safe mode, so it's not Twinkle styling.

image.png (725×226 px, 17 KB)

image.png (382×212 px, 10 KB)

2023-12-12_184101.png (382×212 px, 15 KB)


Any chance we can fix the upper and lower padding with a patch to Vector? I think visually it would make the most sense if the padding in all 4 directions was 16px exactly. Right now there seems to be extra padding on the top (22px total), and extra padding and margin on the bottom (23.4px total).

Yeah, I was going to hide that with:

.vector-dropdown-content::after {
    display: none !important;
}

However I'm prefixing the selector with the MoreMenu ID, so as to not effect the native menus.

I can't gather what this pseudoelement is even for, but I agree that it looks off.

Jan's Twinkle patch is merged and deployed. However, I am getting even more padding at the bottom on enwiki than I was in my dev environment/on testwiki. This is with &debug=1 and a browser hard refresh+clear cache. Yeah, appears to be the ::after tag that MusikAnimal mentioned.

I wonder why testwiki is acting different. Testwiki skins being out of sync with enwiki may be worth a ticket if we can figure out the issue.

image.png (761×244 px, 57 KB)

image.png (773×447 px, 90 KB)

image.png (725×451 px, 61 KB)

image.png (99×636 px, 6 KB)

MoreMenu is now fixed and is now using mw.util.addPortlet.

I hid the pseudoelement mentioned above, and also moved up the menu itself to match the vertical positioning of the "Tools" menu. It seems Twinkle has the same problem with that, too:

Screenshot from 2023-12-12 22-40-14.png (227×379 px, 14 KB)

Screenshot from 2023-12-12 22-40-21.png (227×379 px, 14 KB)

For MoreMenu, I just eyeballed a hacky fix with:

.vector-dropdown-content {
    top: 35px !important;
}

I'm unable to reproduce the disconnected menu issue. Got a steps to reproduce?

In your screenshot, the gap between TW and the <hr> looks bigger than in mine. Perhaps a user script or gadget is creating that space?

image.png (753×1 px, 359 KB)

I'm unable to reproduce the disconnected menu issue. Got a steps to reproduce?

My mistake. It turns out it was the MoreMenu peer gadget. I need to fix that anyway for Vector 2022.

Please disregard!

I wonder why testwiki is acting different. Testwiki skins being out of sync with enwiki may be worth a ticket if we can figure out the issue.

Test wiki is on 1.42.0-wmf.9 and enwiki on 1.42.0-wmf.7 so it's possible a bug in the 1.42.0-wmf.7 branch?

ovasileva triaged this task as Medium priority.Dec 18 2023, 6:34 PM

Seems to be working now @Novem_Linguae - let us know if there's anything else here that we can help with.

Any chance we can fix the upper and lower padding with a patch to Vector? I think visually it would make the most sense if the padding in all 4 directions was 16px exactly. Right now there seems to be extra padding on the top (22px total), and extra padding and margin on the bottom (23.4px total). This is in safe mode, so it's not Twinkle styling.

image.png (725×226 px, 17 KB)

image.png (382×212 px, 10 KB)

2023-12-12_184101.png (382×212 px, 15 KB)

I'm seeing padding of 16px on all sides. Could you share more information? (If you can use https://www.replay.io/ that would also help us diagnose this quicker)

Screenshot 2023-12-18 at 12.24.32 PM.png (1×1 px, 287 KB)

You successfully reproduced it. I see it in your screenshot. Please note the whitespace above CSD and below Config. Hope that helps!

This is a lineheight issue.

Screenshot 2023-12-19 at 20.13.32.png (530×1 px, 336 KB)

The a element in the menu has 6px padding on the vertical axis. Which means that you effectively have 6+16 px of padding at the start and the end of the menu

Thanks all. I've created T353905 to capture the bug to make sure we talk about it in the new year. Please feel free to adjust/comment on that ticket if I have miscaptured anything.