Skip to content

scripts: make ctrl & alt + click work as expected on site links#5

Merged
peaBerberian merged 2 commits intomainfrom
ctrl-keys-click
Oct 13, 2025
Merged

scripts: make ctrl & alt + click work as expected on site links#5
peaBerberian merged 2 commits intomainfrom
ctrl-keys-click

Conversation

@peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Oct 6, 2025

Links in our sidebar and table-of-content overrode the default browser click interactions to allow soft navigation.

This is nice excepted when a modifier key such as control or alt keys are maintained - as those are often relied on respectively to open a link in a new tab or a new window. With our current implementation, we would just soft-navigate on the same page.

I suppose those shortcuts depend on the browser. At first I just did exceptions for those two cases, but I grew uneasy because it didn't seem to me to be the right thing to do.

I ended up asking Claude what was the common approach for what I assume is a common problem, and it answered to me the much more exhaustive solution you see here.

I noticed that our sidebar and table-of-content links overrode click
interactions (to allow soft navigation) even when the control or alt
keys are maintained which are often relied on respectively to open a
link in a new tab or a new window.

I suppose those shortcuts depend on the browser but I thought that as a
quick fix, it made sense to not actually do soft navigation (on the same
page) when one of those two keys is maintained during a click.
@peaBerberian peaBerberian merged commit 8aad378 into main Oct 13, 2025
2 checks 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.

1 participant