When viewing a commit diff, a file toggle button is added to each file header.
Click on the toggle button to either collapse or expand that file block:
In "enabled" mode, using Shift + Click will collapse or expand all file blocks to match the last clicked on toggle button.
An "accordion" mode was added which makes the toggles behave like an accordion.
This code is integrated into the GitHub Dark Script; it is available here separately. There is no need to install both.