react-focus-lock icon indicating copy to clipboard operation
react-focus-lock copied to clipboard

fix: handle user passed in `onBlur` and `onFocus`

Open gavinxgu opened this issue 3 years ago • 2 comments
trafficstars

#189

gavinxgu avatar Dec 21 '21 10:12 gavinxgu

Thank you for this, but let's double-check is that a problem:

  • can you set onFocus and onBlur to the FocusLock in the first place? No - those props are not among propTypes or TypeScript definition.

In this case, I need to ask about your use case to support API extension.

theKashey avatar Dec 21 '21 21:12 theKashey

I didn't check the propTypes. The TypeScript definition of lockProps is Record<string, any>. However, If we do better, the types of as and lockProps should be related.

My usage scenario is like this. I want to use FocusLock's Container to get bubbling React synthetic events, but I found that my onFocus cannot be triggered. Later, I found out that it was because FocusLock covered the onFocus and onBlur that I passed in. But I have solved it by wrapping another layer of div outside the FocusLock and attaching onFocus on this element.

gavinxgu avatar Dec 22 '21 02:12 gavinxgu

This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.

stale[bot] avatar Apr 30 '23 12:04 stale[bot]