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.

FocusTarget Typing Suggestion

See original GitHub issue

version: "focus-trap-react": "^8.7.1"

I recently needed to use focusTrapOptions.initialFocus

initialFocus?: FocusTarget | false;

I tried using HTMLDivElement, but I got an error. Looking at global.d.ts, HTMLDivElement extends HTMLElement, so the suggestion would be to add a generic type, eg:

export type FocusTarget<T extends HTMLElement> = T | SVGElement | string | { (): T | SVGElement };

so that all elements that are extended from HTMLElement be accepted.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
stefcameroncommented, Sep 10, 2021

Once the other focus-trap changes are merged, I’ll publish focus-trap and then publish focus-trap-react to update its dependency on focus-trap, and then you’ll have all the right typings.

1reaction
stefcameroncommented, Sep 10, 2021

OK, great! So that’s basically what we have now (just hasn’t been published yet because there are a few changes in flight still that I’m waiting on to be done). See https://github.com/focus-trap/focus-trap/blob/master/index.d.ts#L14

Read more comments on GitHub >

github_iconTop Results From Across the Web

xurion/ffxi-focus-target - GitHub
FFXI Focus Target. A Windower 4 addon that allows you to focus a target in a similar fashion to Final Fantasy XIV. It...
Read more >
WoW Rookie: Keep your key targets in focus - Engadget
/target focus To quickly make your focus target your current main target, type (or create a macro with the command) /target focus.
Read more >
androidx.compose.ui.focus - Android Developers
This modifier allows you to specify properties that are accessible to focusTarget s further down the modifier chain or on child layout nodes....
Read more >
Focus Target in SUF - MMO-Champion
I can only guess you don't have the focus bar activated? Type: /Suf Go to: Enabled Units In the general section, ensure 'Focus'...
Read more >
How to hide others' debuffs on my target/focus target
yes, i've used that command! and i notice when i type in 0, it unchecks the box, and when i type 1, it...
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