question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider removing default z-indexes

See original GitHub issue

Is your feature request related to a problem? Please describe. Understanding stacking contexts is an important part of being a front-end developer.

In a component like Modal, z-index won’t help if the parent has a stacking-context.

Describe the solution you’d like

  • Remove z-index from components like Modal, but still allow users to set z-index if they wish.
  • Document using React Portals as a better alternative to z-index.
  • Remove the default values, but leave the key available.

It could also be sensible to have a usePortal hook or withPortal prop shipped alongside components that need to be above other content.

I’m very happy to take on this work if you agree with the direction.

Describe alternatives you’ve considered Users of this library could unset default z-index values in the theme if they wished.

Additional context What I’d like to achieve with this issue is to help front-end developers understand z-indexing better than most do today, and to solve these problems in more robust and scalable ways.

I feel that users will continue to hit issues like #691 if relying heavily on z-indexing within apps.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
segunadebayocommented, Jun 7, 2020

This is a good point @mrmckeb. Thanks for bringing it up!

It’s definitely essential to reduce the usage of z-index and lean towards the use of Portals and natural stacking context.

We’ve attempted to solve this in the dev-ts branch by using only Portal and we also created a PortalManager which serves as a container for all Portals, this way it’s easier to see or organize the portals.

To help you achieve this goal in Chakra UI. Here’s what I suggest:

  • Go through the current implementation of our Portal and PortalManager component
  • Go through the modal components (Modal, Popover, Drawer, etc)
  • Kindly suggest improvements or even implement them and PR
  • Write a guide for managing ZIndex so we can add it to the docs

Let me know if this makes sense. I’m happy to help in any way to achieve this goal.

I think it’s important and worth paying attention to.

Thank you, Brody.

1reaction
mrmckebcommented, Jun 29, 2020

I think we’re in a good place! Happy to close this one off.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete an Index - SQL Server | Microsoft Learn
In the Indexes/Keys dialog box, select the index you want to delete. Click Delete. Click Close. On the File menu, select Savetable_name. Using ......
Read more >
How to set new index and remove default index in pandas df
In the df, subVoyageID is the default index, I am trying to remove that blank row next to the subvoyageID, so that all...
Read more >
Pandas: How to Drop a Dataframe Index Column - Datagy
The most straightforward way to drop a Pandas dataframe index is to use the Pandas .reset_index() method. By default, the method will only ......
Read more >
Pandas reset index - How to reset the index and convert the ...
pandas.reset_index in Python is used to reset the current index of a dataframe to default indexing (0 to number of rows minus 1)...
Read more >
Reset Index in Pandas Dataframe - GeeksforGeeks
Let's discuss how to reset index in Pandas DataFrame. ... Output: Example #1: Make Own Index Without Removing Default index.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found