Skip to content

Add visible "Collapse all" / "Expand all" diff buttons to PR Files page #9346

Closed as duplicate

Description

@simonepri

Description

GitHub used to ship native "Collapse all" / "Expand all" buttons above the file list on PRs (closed in #1486 as redundant in 2018), but that UI is no longer present. Today the only built-in way to toggle every file at once is via the modifier-click affordance in toggle-everything-with-alt.tsx: hold ⌥ Option (macOS) / Alt (Windows/Linux) and click any chevron or "Load diff" link to apply to all. That's invisible — there's no UI hint, and on macOS there isn't even a key labeled "Alt" to guess at.

For large PRs this matters: skimming a 50-file PR is much easier when you can collapse everything to a TOC of file headers, then expand on demand — and vice versa when reviewing top-to-bottom.

Proposed UX

Two small buttons in the PR Files page toolbar (next to File filter / Conversations / Diff settings):

  • Collapse all — collapses every `.js-file` (chevron closed)
  • Expand all — expands every `.js-file`, and clicks "Load diff" on the ones GitHub hid behind that link (so the user actually gets the diff content, not just the header)

Same behavior the modifier-click already provides, just discoverable. No new keybindings, no settings.

Notes

  • `toggle-everything-with-alt` can stay as-is; the buttons just provide an explicit entry point to the same operations.
  • Feature gate: `pageDetect.isPRFiles`.

Example URLs

https://github.com/refined-github/refined-github/pull/9325/files

Activity

  1. fregante commented on May 6, 2026

    @fregante
    Member

    For large PRs this matters: skimming a 50-file PR is much easier when you can collapse everything to a TOC of file headers, then expand on demand — and vice versa when reviewing top-to-bottom.

    There's a sidebar for that, you can already skim the PR from the sidebar and then click each file

  2. fregante commented on May 6, 2026

    @fregante
    Member

    there's no UI hint, and on macOS there isn't even a key labeled "Alt" to guess at.

    This is somewhat of a known issue, the keyboard shortcut is only visible in the native shortcut guide via improve-shortcut-help. GitHub also has the same alt-click shortcut natively on some toggles (I forgot which)

  3. simonepri commented on May 6, 2026

    @simonepri
    Author

    FME: What the harm in adding this more visible in the UI? Not clutter the UI?

  4. simonepri commented on May 6, 2026

    @simonepri
    Author

    There's a sidebar for that, you can already skim the PR from the sidebar and then click each file

    That view doesn't give you a bird-eye view of the scale of each change tho. E.g. you have a 100 files CL where they are all 1 lines (e.g. updating an import) and then a few files where there is actual change.

    Image
  5. simonepri commented on May 6, 2026

    @simonepri
    Author

    I agree that once you know you can alt-click,the buttons are not really useful. I'm just arguing that's pretty hidden (but maybe it's just me).

  6. fregante commented on May 6, 2026

    @fregante
    Member

    FME: What the harm in adding this more visible in the UI? Not clutter the UI?

    There are hundreds of actions one can take on that page, what's the harm in adding a button for each of them?

  7. fregante commented on May 6, 2026

    @fregante
    Member

    I'm just arguing that's pretty hidden

    I don't disagree, but we have to pick and choose which features have the greatest advantage. Here you're just saying that we need this feature because:

    • the main view tells shows you the diff amount
    • the alt-click, which already works, is hard to find

    neither reason is compelling enough.

    Because... after all, why not also add a "Mark all files as viewed | Mark all files as not viewed" as well? Just as useful if not more.

    We'll probably want a button to toggle all review comments, they clutter the UI (yes there's a shortcut, but it's hidden).

    We also want a button expand every file (like, show the whole file instead of the diff), that will give a proper overview. Also a button to revert it, of course. (yes toggle-everything-with-alt supports this, but it's hidden)

    and so on, you catch my drift

  8. locked and limited conversation to collaborators on May 27, 2026
  9. marked Bulk "view" files in PR #9764 as a duplicate of this issue on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions