Page MenuHomePhabricator

[Timebox] MenuButton gets cut off in a table
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

The MenuButton action menu renders correctly in most line items of a table except when it doesn't:

Screenshot 2024-07-12 at 12.49.15 PM.png (1×2 px, 244 KB)

Screenshot 2024-07-12 at 12.49.02 PM.png (1×2 px, 245 KB)

Screenshot 2024-07-12 at 12.49.23 PM.png (1×1 px, 221 KB)

Screenshot 2024-07-12 at 12.49.31 PM.png (1×2 px, 242 KB)

The current application is still WIP but available to folks via IDP (CAS-SSO) which is required for access:
staging - https://mpic-next.wikimedia.org/
production - https://mpic.wikimedia.org/

Successful login will bring users to the Catalog view which is the table with MenuButtons in the screenshots above.

Our code for reference for the table in the screenshots:
https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/blob/main/frontend/src/components/List.vue?ref_type=heads


Acceptance criteria

  • Prevent menu from opening in the completely wrong direction inside a Table
  • Consider trying to make it possible for menus to extend beyond the table they're within

Event Timeline

CCiufo-WMF moved this task from Inbox to Up Next on the Design-System-Team board.

We will try to take a look at this next sprint (starting July 22), or this sprint if there's extra capacity.

CCiufo-WMF renamed this task from MenuButton gets cut off in a table to [Timebox] MenuButton gets cut off in a table.Jul 22 2024, 5:12 PM
CCiufo-WMF set the point value for this task to 3.
AnneT changed the task status from Open to In Progress.Jul 23 2024, 6:51 PM
AnneT claimed this task.

Change #1056602 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] demo: Add Table demo with row actions

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

I submitted a patch with a new demo that reproduces this behavior in the Sandbox so you don't have to spin up MPIC to see the bug. There are 2 issues here:

  1. Menus do not expand beyond the limits of the table (or possibly the table wrapper element). Should they?
  2. FloatingUI seems to get confused by the MenuButton in the third row, maybe because it's on the threshold of whether the menu should open up or down, so it ends up opening down and at the start of the button when it should open up and at the end of the button. I think this is happening because we've set the fallbackStrategy to "initialPlacement", when in this case the default of "bestFit" would be better.

Change #1056604 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] FloatingUI: Use default fallbackStrategy

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

@Catrope do you remember why you implemented the initialPlacement fallback strategy way back in this patch? I'm trying to figure out if it's needed - it's messing up the MenuButton behavior, and doesn't seem necessary for other components IMO but I'm not sure.

If it is necessary, we could add a FloatingMenuOption for the fallbackStrategy and only change it to bestFit for MenuButton.

I don't remember exactly, and comparing your patch to the last release, it does look like bestFit is better overall. I was concerned about the behavior if the height of the viewport is so small (or the height of the menu so great) that the menu doesn't completely fit either below or above, and I didn't want it to be too aggressive in moving from "below" to "above" in that case. However, initialPlacement seems to behave worse in every possible case, including that one, so I think we should change it per your patch.

Change #1056602 merged by jenkins-bot:

[design/codex@main] demo: Add Table demo with row actions

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

AnneT added a subscriber: egardner.

@Catrope @egardner the first acceptance criterion is complete. I also think it's worth considering whether menus within Tables should be able to extend beyond the boundaries of the Table. If that seems beyond the scope of this task, you could open a new one.

Change #1056999 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/core@master] Update Codex from v1.9.0 to v1.10.0

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

Change #1056604 merged by jenkins-bot:

[design/codex@main] FloatingUI: Use default fallbackStrategy

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

Change #1060504 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from v1.10.0 to v1.11.0

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

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
https://patchdemo.wmcloud.org/wikis/e5da39d6d5/w

Change #1060504 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v1.10.0 to v1.11.0

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