new(Overlay): Add enableMouseInteraction
prop
#391
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
to: @williaster @alecklandgraf
Description
This PR adds the
enableMouseInteraction
prop toOverlay
andOverlay/Portal
to enable mouse events and mouse interaction in Overlays. In the Overlay portal stylesheet, we extract thecontainer
class'userSelect: 'none'
out into anoUserSelect
class, and introduce thehasPointerEvents
withPointerEvents
class to explicitly enable pointer events in Overlay. These two classes are composed in such a way that there are no breaking changes.Motivation and Context
Overlay's portal implementation is useful for Tooltip and Popover popups, which need to escape their parent divs. The current Popover implementation renders the popup in a div with a set zIndex, which does not let the popup escape a DataTable row, while a plain Tooltip's
<Overlay></Overlay>
popup is able to escape the DataTable as intended.To allow Popover to use
<Overlay>
for its Portal rendering and positioning logic, we added the ability to enable pointer events in Overlay so that Popover's mouse event based timeout logic and copy-paste functionality could work when implemented with Overlay.Testing
Tested in storybook.
Screenshots
An overlay without

enableMouseInteraction
prop:An overlay with

enableMouseInteraction
prop (mouse can interact with content in the overlay):Checklist