···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-28
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, it is typically on
2020+ separate tab
2121+- comments are rendered inside the diff
2222+- inline comments are attached to a single line
2323+2424+To redesign the PR page for Tangled, I wanted to address
2525+these nits. As with every interface, some folks may be
2626+acclimatized to one design, and would rather not see it
2727+changed.
2828+2929+## diffs up front
3030+3131+Code and review are equally important in code-review. It
3232+would be criminal to put them on separate tabs, but most
3333+forges do:
3434+3535+<figure class="max-w-[550px] m-auto flex flex-col items-center justify-center">
3636+ <a href="https://assets.tangled.network/blog/pr-review-ui/Separate%20tabs.png">
3737+ <img class="my-1 h-auto max-w-full" src="https://assets.tangled.network/blog/pr-review-ui/Separate%20tabs.png">
3838+ </a>
3939+</figure>
4040+4141+Let's move the diff into the main view, evicting
4242+conversations for now:
4343+4444+<figure class="max-w-[550px] m-auto flex flex-col items-center justify-center">
4545+ <a href="https://assets.tangled.network/blog/pr-review-ui/Diff%20inline.png">
4646+ <img class="my-1 h-auto max-w-full" src="https://assets.tangled.network/blog/pr-review-ui/Diff%20inline.png">
4747+ </a>
4848+</figure>
4949+5050+To deal with the comments now, they *could* be overlaid on the
5151+diff, like GitHub does...
5252+5353+<figure class="max-w-[550px] m-auto flex flex-col items-center justify-center">
5454+ <a href="https://assets.tangled.network/blog/pr-review-ui/Overlaid%20comments.png">
5555+ <img class="my-1 h-auto max-w-full" src="https://assets.tangled.network/blog/pr-review-ui/Overlaid%20comments.png">
5656+ </a>
5757+</figure>
5858+5959+... but this makes the code hard to read. Review systems
6060+like Figma and Google docs put the conversations off to the
6161+right. This is especially nice with code review, because you
6262+tend to want to jump around the diff as you author the
6363+comment, or jump around the diff as you read a review:
6464+6565+<figure class="max-w-[550px] m-auto flex flex-col items-center justify-center">
6666+ <a href="https://assets.tangled.network/blog/pr-review-ui/More%20convos%20inline.png">
6767+ <img class="my-1 h-auto max-w-full" src="https://assets.tangled.network/blog/pr-review-ui/More%20convos%20inline.png">
6868+ </a>
6969+</figure>
7070+7171+Nowadays, forges include a filetree to the left, so lets add
7272+that in as well:
7373+7474+<figure class="max-w-[550px] m-auto flex flex-col items-center justify-center">
7575+ <a href="https://assets.tangled.network/blog/pr-review-ui/Add%20file%20tree.png">
7676+ <img class="my-1 h-auto max-w-full" src="https://assets.tangled.network/blog/pr-review-ui/Add%20file%20tree.png">
7777+ </a>
7878+</figure>
7979+8080+It's definitely *cozy*, so all panels should be collapsible:
8181+8282+<figure class="max-w-[550px] m-auto flex flex-col items-center justify-center">
8383+ <a href="https://assets.tangled.network/blog/pr-review-ui/Convos%20can%20be%20collapsible.png">
8484+ <img class="my-1 h-auto max-w-full border-none" src="https://assets.tangled.network/blog/pr-review-ui/Convos%20can%20be%20collapsible.png">
8585+ </a>
8686+</figure>
8787+8888+8989+## authoring review comments
9090+9191+When writing review comments, you often want to scroll up
9292+and down through the diff to build an understanding of the
9393+change. If the UI opened up a comment box in place...
9494+9595+<figure class="max-w-full m-auto flex flex-col items-center justify-center">
9696+ <a href="https://assets.tangled.network/blog/pr-review-ui/In-place%20comment%20authoring%20is%20a%20struggle.png">
9797+ <img class="my-1 h-auto max-w-full border-none" src="https://assets.tangled.network/blog/pr-review-ui/In-place%20comment%20authoring%20is%20a%20struggle.png">
9898+ </a>
9999+</figure>
100100+101101+... it makes it hard to type out the comment *and* scroll
102102+through the diff.
103103+104104+<!-- animate this? -->
105105+106106+We could put comment authoring off to the side:
107107+108108+<figure class="max-w-full m-auto flex flex-col items-center justify-center">
109109+ <a href="https://assets.tangled.network/blog/pr-review-ui/Conversation%20scrolls%20separately%20from%20diff.png">
110110+ <img class="my-1 h-auto max-w-full border-none" src="https://assets.tangled.network/blog/pr-review-ui/Conversation%20scrolls%20separately%20from%20diff.png">
111111+ </a>
112112+</figure>
113113+114114+This not only allows scrolling the diff separately, but also
115115+lets you write comments free-form in text-box, so you could
116116+reference multiple hunks in a single comment. A comment is
117117+not attached to a single location:
118118+119119+<!-- reference multiple hunks -->
120120+121121+## implementation
122122+123123+First, on the topic of rendering large diffs. Diffs are
124124+inherently super heavy DOM objects. Each diff line needs to
125125+include a:
126126+127127+- line number
128128+- diff symbol
129129+- red/green/neutral background
130130+- line content
131131+132132+And this is without syntax-highlighting or character-wise
133133+diffing! Here, I sympathize with GitHub and the likes. The
134134+only way to not crash the page on larger diffs is to just
135135+hide them or use simpler HTML representations.
136136+137137+As for the collapsible panels, this is easily implemented
138138+using plain CSS! By turning all toggles into checkboxes, we
139139+can use the `:checked` pseudo class:
140140+141141+```css
142142+#comment-panel {
143143+ display: hidden;
144144+}
145145+146146+#toggle:checked ~ #comment-panel {
147147+ display: block;
148148+}
149149+```
150150+151151+Finally, to author comments, you can just copy the link to
152152+the line you want to refer to, and paste that into the text
153153+box on the side:
154154+155155+<!-- paste link into comment box -->
156156+157157+With a bit of JS, this can be automated with a
158158+click-to-comment style interface, which populates the
159159+comment box with the link to that line:
160160+161161+<!-- show click-to-comment video -->
162162+163163+Each comment is simply a free-form text message with links
164164+to code, clicking a link scrolls the page down to the
165165+target:
166166+167167+<!-- show clicking link video -->
168168+169169+## notes
170170+171171+with a few minor rearrangements, i believe we have made
172172+genuine improvements to the standard PR interface offered by
173173+GitHub, GitLab or Forgejo:
174174+175175+- zero extra clicks to view the diff
176176+- diff and conversation can be read side-by-side
177177+- JS-optional reviewing and commenting