Skip to content

Adjust sidenotes to not rely on border width subtraction#58

Merged
DanilaFe merged 1 commit intochapel-lang:mainfrom
DanilaFe:fix-sidenote-size-jumps
Feb 24, 2026
Merged

Adjust sidenotes to not rely on border width subtraction#58
DanilaFe merged 1 commit intochapel-lang:mainfrom
DanilaFe:fix-sidenote-size-jumps

Conversation

@DanilaFe
Copy link
Contributor

@DanilaFe DanilaFe commented Feb 23, 2026

Closes #26.

As I outlined in the issue:

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
notenohover noteoldhover notenewhover

I think it looks pretty nice:

Screenshot 2026-02-23 at 10 34 02 AM

Reviewed by @benharsh -- thanks!

Testing

  • 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.

Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
@bradcray
Copy link
Member

This change looks good to me in action, and I verified that the sidenotes that caused me to open the original issue don't change their linefeeds under this branch. Thanks!

@DanilaFe DanilaFe merged commit 8cb4376 into chapel-lang:main Feb 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hovering over a sidenote can change its linefeeds

3 participants