Collapse / Expand all diffs

Proposal

Summarising a discussion from !137878 (comment 1923989118)

Instead of having a single button to collapse or expand.

We want to have 2 separate buttons on the UI to indicate to user what's the action is. The recommendation is to have an icon-only button (without the labels) as showed on the prototype bellow:

CleanShot_2024-05-29_at_20.51.06.mp4

Tooltips

We want to have a tooltip for each button with the correspondent shortcut:

Expand Collapse
Expand all files ; Collapse all files Shift + ;
Original Issue Description

Proposal

For Merge Request UI in Changes tab, please add:

  • Alt + Click an expanded diff to collapse all diffs.
  • Alt + Click a collapsed diff to expand all diffs.

It's acceptable if "all diffs" for these actions is only those that are currently loaded in the page. Thus if there are so many that some are not loaded, then say collapsing all may not get them all, perhaps due to many being collapsed more load in the page and then the Alt + Click can be repeated to collapse more, rinse and repeat.Ideally, "all diffs" would truly do all of them, but understood large web pages essentially stream in.Either way, if the user has loaded all of the diffs into the browser then these UI interactions would affect all diffs.Ultimately, want a clean way to collapse all of the diffs for a quick view through them, e.g. seeing their "viewed" checkbox state, etc. Makes for far easier and subjectively better navigation than the tree browser thing.

Background

This has been asked for before, e.g. here though that ask is for a Button. Please no Button for this where Alt + Click would work great.

Not to just copy the others, but GitHub has exactly this proposed feature already - and it works great! https://github.blog/changelog/2018-08-17-collapse-all-diffs-in-a-pull-request-at-once/

Buttons

There is an existing "Expand all files" button. That would no longer be needed as Alt + Click could be a replacement. Also there is no counterpart "Collapse all files", again Alt + Click would give that without any Button or UI real estate.Past discussions seem to be a lot about UI design and not having space for a button, etc. This has no new UI need other than supporting Alt + Click as described above.

Edited by Michael Le