MetaCell / geppetto-scidash

Geppetto scidash extension
2 stars 1 forks source link

Close dialogs (lightbox) when clicking outside and not just with the X button #356

Open gidili opened 5 years ago

gidili commented 5 years ago

From @rgerkin: Currently only "Close" closes the lightbox. In many UIs, just clicking outside of the lightbox closes it. This would be an improvement if it is easy to do.

rgerkin commented 4 years ago

This is one of those things that either has a solution that can be googled and implemented in 20 minutes, or isn't worth doing.

ddelpiano commented 4 years ago

@rgerkin this is a conservative estimates and it's not more about the implementation that is quite trivial and will be described below, it's more about the fact that this will have to be copy-pasted (almost) in all the components that use the dialog component. The implementation itself consists in creating a function that get the event.target and check if the dialog ref contains the event.target, depending on this condition the component's state will be updated accordingly to reflect the open/close dialog state. This function will be then hooked to the mouse event 'mousedown' in the componentDidMount.