Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ListBox): change ListBox z-index higher than modal #8107

Merged
merged 3 commits into from
Mar 23, 2021

Conversation

tw15egan
Copy link
Member

@tw15egan tw15egan commented Mar 16, 2021

Refs #2660
Refs #6365

Screen Shot 2021-03-16 at 1 12 03 PM

This stems from a conversation on Slack from @carbon-design-system/angular-maintainers and you can see the issue occurring here. This was previously fixed by the Angular team in #2660 but reverted in #6365

Updates ListBox elements z-index values to above Modal, so that a Dropdown rendered outside of the Modal content (to prevent Dropdown causing scrolling inside Modal) will appear above the Modal itself. This should not cause any issues when triggering a Modal when a ListBox element is open, since the menu's all close when the focus is removed. Let me know if I am missing a particular use-case.

Changelog

Changed

  • Bumps dropdown value from 6000 to 9100
  • Rearranged values in descending order

Testing / Reviewing

z('dropdown') is only used in Dropdown and Listbox components

@netlify
Copy link

netlify bot commented Mar 16, 2021

Deploy preview for carbon-elements ready!

Built with commit b8864ec

https://deploy-preview-8107--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Mar 16, 2021

Deploy preview for carbon-components-react ready!

Built with commit b8864ec

https://deploy-preview-8107--carbon-components-react.netlify.app

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this issue has swung back and forth it might be worth specifically targeting components within a modal for a z-index bump rather than re-reverting a global variable (i.e. modal z-index > dropdown z-index but dropdown z-index within a modal > modal?). it looks like this same concern was raised in #2660 as well

@cal-smith
Copy link
Contributor

since this issue has swung back and forth it might be worth specifically targeting components within a modal for a z-index bump rather than re-reverting a global variable (i.e. modal z-index > dropdown z-index but dropdown z-index within a modal > modal?). it looks like this same concern was raised in #2660 as well

I'd be curious why the cleanup reverted the list-box to below the modal in the first place - It seems logical to me that floating menus and lists should occupy the top of the z-index range, with modals and other "windows" sitting somewhere below. As far as I understand menus and dropdowns should close when a modal opens (even just by virtue of it being an outside click), so that shouldn't cause a layering conflict.

This particular issue occurs because of what's required to break out of a modal - the list-box has to be rendered into the body. I'm not sure how you would specifically target the list-box when it's not a sibling of the dropdown, or a child of the modal?

As mentioned in #2660, the whole z-index order probably should be reworked a bit anyway - setting it to 9100 was a minimally breaking hack.

@cal-smith
Copy link
Contributor

Perhaps commenting why the z-indices are what they are in the code would help prevent this from regressing unnecessarily?

@tw15egan
Copy link
Member Author

tw15egan commented Mar 18, 2021

@cal-smith agreed, z-index's should probably be revisited as a whole, but added a comment for now. I didn't change floating as this can already be achieved by adding data-floating-menu-container to the modal.

@emyarod due to the way the Angular team is rendering Dropdowns (child of body and not modal) this change is needed. Since menus close on loss of focus, there shouldn't be any issues with them rendering on top of, say, a modal when it opens

@kodiakhq kodiakhq bot merged commit eb43164 into carbon-design-system:main Mar 23, 2021
@tw15egan tw15egan deleted the update-z-values branch March 3, 2022 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants