You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
I would like to be able to handle the modal's state if I want to. Right now, I'm forced to close the modal on background click. I could turn it off, and handle the click on my own, but I'll have to target the background and add an event listener to do so.
Solution
The modal will use onClose prop for both pressing the escape key AND on background click. This way, I can control what happens when the modal has been triggered to close.
Alternatives/Context
Maybe adding more granularity and describing those events. Maybe pass a name of which event is being fired, that way I can do different actions on those events. Or, just have separate props I can pass in to do different actions based on what I pass, and default to use onClose if nothing is passed in. For example having onBackgroundClick, onEscapePress, & onClose all as props to pass through.
Problem
I would like to be able to handle the modal's state if I want to. Right now, I'm forced to close the modal on background click. I could turn it off, and handle the click on my own, but I'll have to target the background and add an event listener to do so.
Solution
The modal will use onClose prop for both pressing the escape key AND on background click. This way, I can control what happens when the modal has been triggered to close.
Alternatives/Context
Maybe adding more granularity and describing those events. Maybe pass a name of which event is being fired, that way I can do different actions on those events. Or, just have separate props I can pass in to do different actions based on what I pass, and default to use onClose if nothing is passed in. For example having onBackgroundClick, onEscapePress, & onClose all as props to pass through.