[Portal] Explore giving more control for layering
See original GitHub issueWe currently apply the maximum z-index
on portals and have had a few requests to allow more control here. This ticket is to explore ways of allowing that for a few reasons:
- People have requested it
- Can only override all portal instances via the
data-radix-portal
attribute atm - Other Radix components provide an API to control things (consistency)
- The
data-radix-portal
attribute is an inconsistent escape hatch that we removed from other comps
An initial discussion on this topic provided a couple ideas:
- A
layer
/zIndex
prop for portalled parts, e.g.<DialogContent layer={3}>
- ~A
Portal
provider part exposed per component that provides its props to the internal portal, e.g.<DialogPortal style={{ zIndex: 3 }}><DialogContent /></DialogPortal>
. The provider suggestion is because we need control internally of how/where/when the portal is rendered.~ - Expose a
Portal
part for people to wrap when they want portals, e.g.Dialog.Portal
. Examples. - Use
Slot
internally on thePortal
. This would reduce elements rendered as an additional win but it wouldn’t work with:Popper
based parts because popper wraps its own additionaldiv
for positioning- Parts that use https://github.com/theKashey/react-remove-scroll because portal needs to wrap the
RemoveScroll
part for it to work, andRemoveScroll
isn’t slot-aware.
- Any more for any more?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:26 (10 by maintainers)
Top Results From Across the Web
Manage hosted web layers—Portal for ArcGIS
You control the following for your hosted web layers: ... Add, update, and delete features gives editors the most privileges of the three...
Read more >Protect Assets with Layered Commercial Security Access ...
In this post, we'll examine the three main access control methods and how they work together to create a layered business security system....
Read more >Configure pop-ups—Portal for ArcGIS
Open the map in Map Viewer, click Details, and click Contents. Browse to the sublayer that contains the feature data you want to...
Read more >Known issues | App Layering - Citrix Product Documentation
When you enable an image with elastic layering, users might be able to view files and directories from other sessions in Windows Explorer....
Read more >What is Machine Learning? | IBM
A neural network that consists of more than three layers—which would be ... Economic Area, giving individuals more control of their data.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’ve published a release candidate for this in Dialog and AlertDialog to try. The API has breaking changes with this change so we would love feedback on the approach before we roll it out across our other components.
The new anatomy is as follows:
Note:
Dialog.Content
can be rendered insideDialog.Overlay
if preferred for styling purposes.Dialog.Portal
doesn’t render adiv
anymore soz-index
styles can be applied toDialog.Overlay
/Dialog.Content
directly.Dialog.Portal
can portal into a custom container using thecontainer
prop:Having more control here would be really helpful. My use-case is that I’m using react-toastify to show toasts; on mobile I’m using modals as full-page takeovers and sometimes want to show a toast over it. I can use
Portal
to put my toasts above everything but since they’re always max z-index as soon as the overlay and modal mount they’re always on top of the toasts. Having a little wiggle room here would be helpful.I think exposing Portal in the Dialog primitive makes sense and will allow more control over how the Dialog renders. It’s definitely a little more overhead but not much more than having to compose all the other parts anyway and will give developers much more control over how things behave.