TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to add robust keyboard shortcuts to your site

14 pointsby cirwinover 11 years ago

2 comments

nfozover 11 years ago
... but please don't, because you probably shouldn't. I wish my user agent wouldn't respect keyboard shortcuts except perhaps a whitelist of sites. Too often they replace actual browser interaction shortcuts, e.g. spacebar to pagedown (google is often guilty of this).
评论 #6917935 未加载
fjhqjvover 11 years ago
I wish the article would go more into keypress events in general and properly organizing code to make attaching shortcuts to it simple, rather than building yet another antipattern into the Jenga tower of bad jQuery code.<p>The real root of the problem here is systematically tying UI actions to events on specific elements in the DOM. Instead of working around it, why not write slightly cleaner code in the first place?<p>It&#x27;s also not strictly necessary to use a third-party library for this unless you&#x27;re butting heads with one of the edge cases the library is designed to solve.
评论 #6918289 未加载
评论 #6918304 未加载