···11+---
22+atroot: true
33+template:
44+slug: review
55+title: revisiting the pull-request interface
66+subtitle: an attempt at fixing some gripes with the PR UI
77+date: 2026-04-16
88+image: https://assets.tangled.network/blog/hidden-ref.png
99+authors:
1010+ - name: Akshay
1111+ email: akshay@tangled.sh
1212+ handle: oppi.li
1313+draft: true
1414+---
1515+1616+I have a few nits with the pull-request interface on
1717+traditional forges:
1818+1919+- the diff is not shown up front
2020+- comments are rendered inline, making it hard to navigate
2121+ code and read reviews simultaneously
2222+- in GitHub's case, diffs are rendered dynamically with
2323+ JS, which breaks Ctrl+F often
2424+- inline review comments cannot refer to multiple locations,
2525+ they are fixed to a single line
2626+2727+To redesign the PR page for Tangled, I wanted to address
2828+these nits. As with every interface, some folks may be
2929+acclimatized to one design, and would rather not see it
3030+changed.
3131+3232+## diffs up front
3333+3434+Code and review are equally important in code-review. It
3535+would be criminal to put them on separate tabs. Lets move
3636+the diff into the main view, evicting conversations for now:
3737+3838+<!-- image of inlined diff -->
3939+4040+The comments could be overlaid on the diff, like GitHub
4141+does...
4242+4343+<!-- image of overlaid comments -->
4444+4545+... but this makes the code hard to read. Review systems
4646+like Figma and Google docs put the conversations off to the
4747+right. This is especially nice with code review, because you
4848+tend to want to jump around the diff as you author the
4949+comment, or jump around the diff as you read a review:
5050+5151+5252+<!-- image of comment panel -->
5353+5454+Nowadays, forges include a filetree to the left, so lets add
5555+that in as well:
5656+5757+<!-- image of file tree panel -->
5858+5959+Its definitely *cozy*, so all panels should be collapsible:
6060+6161+<!-- image of comment panel collapsed -->
6262+6363+## authoring review comments
6464+6565+When writing review comments, you often want to scroll up
6666+and down through the diff to build an understanding of the
6767+change. If the UI opened up a comment box in place...
6868+6969+7070+<!-- inplace comment box -->
7171+7272+... it makes it hard to type out the comment *and* scroll
7373+through the diff.
7474+7575+<!-- animate this? -->
7676+7777+We could put commit authoring off to the side:
7878+7979+<!-- image of side panel commenting -->
8080+8181+This not only allows scrolling the diff separately, but also
8282+lets you write comments free-form in text-box, so you could
8383+reference multiple hunks in a single comment. A comment is
8484+not attached to a single location:
8585+8686+<!-- reference multiple hunks -->
8787+8888+## implementation
8989+9090+First, on the topic of rendering large diffs. Diffs are
9191+inherently super heavy DOM objects. Each diff line needs to
9292+include a:
9393+9494+- line number
9595+- diff symbol
9696+- red/green/neutral background
9797+- line content
9898+9999+And this is without syntax-highlighting or character-wise
100100+diffing! Here, I sympathize with GitHub and the likes. The
101101+only way to not crash the page on larger diffs is to just
102102+hide them or use simpler HTML representations.
103103+104104+As for the collapsible panels, this is easily implemented
105105+using plain CSS! By turning all toggles into checkboxes, we
106106+can use the `:checked` pseudo class:
107107+108108+```css
109109+#comment-panel {
110110+ display: hidden;
111111+}
112112+113113+#toggle:checked ~ #comment-panel {
114114+ display: block;
115115+}
116116+```
117117+118118+Finally, to author comments, you can just copy the link to
119119+the line you want to refer to, and paste that into the text
120120+box on the side:
121121+122122+<!-- paste link into comment box -->
123123+124124+With a bit of JS, this can be automated with a
125125+click-to-comment style interface, which populates the
126126+comment box with the link to that line:
127127+128128+<!-- show click-to-comment video -->
129129+130130+Each comment is simply a free-form text message with links
131131+to code, clicking a link scrolls the page down to the
132132+target:
133133+134134+<!-- show clicking link video -->
135135+136136+## notes
137137+138138+with a few minor rearrangements, i believe we have made
139139+genuine improvements to the standard PR interface offered by
140140+GitHub, GitLab or Forgejo:
141141+142142+- zero extra clicks to view the diff
143143+- diff and conversation can be read side-by-side
144144+- JS-optional reviewing and commenting