question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to scope to elements

See original GitHub issue

It would be nice if it had to ability to scope based on a ref. Example:

  const ref = useHotkeys('ctrl+k', () => setCount(prevCount => prevCount + 1));
    
  return (
    <p ref={ref} tabindex={-1}>
      Pressed {count} times.
    </p>
  );

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JohannesKlausscommented, Aug 5, 2020

Using 2.2.0 the hook returns an RefObject that can be set to any element taking a ref. Then the callback will only get executed when the reffed object is focused.

1reaction
fryczcommented, Jun 30, 2020

No problem. After analyzing our needs we realized that our case is so simple that we don’t need any external libraries nor generic solutions. We just added a keydown event listener to our input component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is Scope? Understanding Project Scope vs. Product Scope
Scope refers to the combined objectives and requirements needed to complete a project. The term is often used in project management as well...
Read more >
How to Write a Project Scope in 8 Easy Steps [2022] • Asana
Defining your project scope is a key element of project planning. ... your project could warp and grow beyond your team's ability to ......
Read more >
Project Scope Management
... ability must simultaneously manage the four basic elements of a project: resources, time, money and most importantly scope (8).
Read more >
In Scope vs. Out of Scope Meaning With Examples - Indeed
The scope of a project includes all the elements of a project that a team plans ... As a project manager, you will...
Read more >
5 steps to define the scope of a project - Rock Content
The scope would include elements such as the audience you aim to reach, ... and how they can affect your ability to complete...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found