theKashey / react-focus-lock

It is a trap! A lock for a Focus. 🔓
MIT License
1.27k stars 67 forks source link

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

Closed gavinxgu closed 1 year ago

gavinxgu commented 2 years ago

189

theKashey commented 2 years ago

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

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

gavinxgu commented 2 years ago

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.

stale[bot] commented 1 year ago

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.