8000 add new keyboard shortcut to jump to the most recent link target by michaelficarra · Pull Request #645 · tc39/ecmarkup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add new keyboard shortcut to jump to the most recent link target #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025

Conversation

michaelficarra
Copy link
Member

This adds ` as a new keyboard shortcut to jump to the last place you jumped. I like to think of it as a kind of "dynamic pin". When I click a link to somewhere in the spec, I often scroll or Ctrl-F my way away without thinking of pinning it and want a quick way to get back to what I was just looking at. I chose ` for the key because it nicely aligns with the numbered pins on my keyboard and the above-stated mental model as another pin. Also, it's the same key used to jump to a mark in vim.

@michaelficarra michaelficarra requested a review from bakkot April 29, 2025 17:18
this.selectPin((e.keyCode - 9) % 10);
} else if (e.key === '`') {
if (document.location.hash) {
document.querySelector(document.location.hash).scrollIntoView(true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be done with document.location = document.location, but that felt gross to me.

@bakkot bakkot merged commit 9c70501 into main Apr 29, 2025
2 checks passed
@bakkot bakkot deleted the jump-to-last-target branch April 29, 2025 17:25
gibson042 added a commit to gibson042/ecmarkup that referenced this pull request Apr 29, 2025
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.

2 participants
0