microsoft / fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
https://react.fluentui.dev
Other
18.53k stars 2.74k forks source link

Modal and DropZone are not working nicely #13593

Closed joosttk closed 4 years ago

joosttk commented 4 years ago

Environment Information

Please provide a reproduction of the bug in a codepen:

https://codesandbox.io/s/stoic-tree-53guu?file=/src/app.js

Actual behavior:

When adding a DropZone to a Modal component, it does not trigger the "onDrop" callback function. Having the same DropZone component in the main App component (i.e. not in a Modal), works as expected (it triggers the onDrop).

Expected behavior:

Behaviour of a DropZone in a Modal component should be the same as a DropZone that is not in a model (i.e. it should trigger the onDrop callback).

Priorities and help requested:

Are you willing to submit a PR to fix? No

Requested priority: Normal

Kesshi commented 4 years ago

You have to enable event bubbling to make it work. Like this in your example:
<Modal isOpen={isOpen} onDismiss={() => setIsOpen(false)} layerProps={{ eventBubblingEnabled: true }}>

joosttk commented 4 years ago

You have to enable event bubbling to make it work. Like this in your example: <Modal isOpen={isOpen} onDismiss={() => setIsOpen(false)} layerProps={{ eventBubblingEnabled: true }}>

Awesome! That fixed it :)

paulgildea commented 4 years ago

Thanks for the help @Kesshi!

@jdhuntington - maybe we should add this to Stack Overflow so that more folks know about it in the short term.