Commit 8cb4376
authored
Adjust sidenotes to not rely on border width subtraction (#58)
Closes #26.
[As I outlined in the
issue:](#26 (comment))
> The reason you're still seeing the issue is that borders (and borders
in particular) are rounded by the browser to device pixel boundaries.
Thus, the computation for the [smaller padding to compensate for the
bigger border] doesn't exactly match the change in border width. The end
result is a barely-noticeable layout shift.
> There's no way to soundly fix this since rounding behavior depends on
display, pixel density, and zoom. Instead, I can change our style to
change the border color and add a drop shadow to highlight the
hovered-over note. This precludes the need for the computation I
described (because the border width now remains constant), and thus
removes any place where rounding can make its way in.
This PR does this.
| No Hover | Old Hover | New Hover |
|-|-|-|
||||
I think it looks pretty nice:
<img width="1034" height="476" alt="Screenshot 2026-02-23 at 10 34
02 AM"
src="https://github.com/user-attachments/assets/bf17a322-2dfe-40d2-9cae-417cba8d9ac3"
/>
Reviewed by @benharsh -- thanks!
## Testing
- [x] hover no longer changes line breaks in sidenotes on any zoom level
I tried in the 10 myths, part 7 post from the original issue.1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments