-
Notifications
You must be signed in to change notification settings - Fork 196
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
chore(dialog): z-index for dialog docs #2855
chore(dialog): z-index for dialog docs #2855
Conversation
|
🚀 Deployed on https://pr-2855--spectrum-css.netlify.app |
File metricsSummaryTotal size: 4.66 MB* Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
Detailssite
* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I validated on the PR site and this fixes the issues on the docs page for Dialog 🎉
There may be some changes we should make in the future to be more in line with SWC or to be clear about how source order affects both Underlay and Dialog being used together:
Thoughts on the z-indexes:
I poked around a little bit and I see what is going on now, and am wondering if this should be looked into as a followup issue. The original display issue stems from both .spectrum-Modal
and .spectrum-Underlay
having z-index: 1
, and whether one displays on top of the other depends on the source order.
In the original prod issue, there is only a single underlay, later on in the HTML source (after the Dialog markup). In Storybook, the underlay markup appears before the Dialog, which is why it looks fine; you can test to see the bug behavior there by dragging the underlay to be after the Dialog in the DOM inspector.
I looked at Spectrum Web Components, and they have the underlay within what we call .spectrum-Modal-wrapper
(their sp-dialog-base
uses those styles), also before the dialog modal:
This brings up a few questions for me:
- If we want to allow underlay to be later in the source, should
.spectrum-Modal
havez-index: 2
? - If underlay should always be before the modal, should we have multiple underlay divs for each one of these examples, and the JS should be targeting those? And should that be documented?
- If so (# 2), should we be more in line with SWC and have the underlay nested within
.spectrum-ModalWrapper
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does indeed fix the issue! I’m honestly a little puzzled because it looks like .spectrum-Modal
does have a z-index: 2
in the code but every time I inspect (and also in the dist
), it has a z-index: 1
. Seems like something in the build is changing the z-index, maybe? 🤔
If the modal is expected to always have z-index: 1
then I would say let’s not throw !important
in with z-index: 2 !important
but since I'm seeing z-index: 2
for .spectrum-Modal
and !important
is already pretty liberally sprinkled in with the CSSExample classes, this feels like the right choice.
+1 to Josh’s point that underlay isn’t causing issues elsewhere because of the stacking order (looks like from his comment he’s also seeing .spectrum-Modal
having z-index: 1
), this would be a good thing to clarify at some point.
dd31ef2
to
01bc3e3
Compare
- added `.spectrum-CSSExample-modal` to mimic `.spectrum-Modal-wrapper` with z-index that should position it above `.spectrum-Underlay` - adds/removes classes in dialog.yml to better implement the open/close behaviors. The hero, no divider, and dismissible dialogs are now closed on page load.
01bc3e3
to
5ea1e1f
Compare
- added `.spectrum-CSSExample-modal` to mimic `.spectrum-Modal-wrapper` with z-index that should position it above `.spectrum-Underlay` - adds/removes classes in dialog.yml to better implement the open/close behaviors. The hero, no divider, and dismissible dialogs are now closed on page load.
- added `.spectrum-CSSExample-modal` to mimic `.spectrum-Modal-wrapper` with z-index that should position it above `.spectrum-Underlay` - adds/removes classes in dialog.yml to better implement the open/close behaviors. The hero, no divider, and dismissible dialogs are now closed on page load.
Description
Currently on the static docs site, the dialogs don't really function properly (the default dialog does however, work properly in Storybook. If you close any open dialog variant, and try to reopen it, it is "stuck" underneath
spectrum-Underlay
. I believe this is because az-index: 1 !important
is overriding otherz-index: 2
s forspectrum-Modal
.This PR adds a new
.spectrum-CSSExample-modal
class to mimic.spectrum-Modal-wrapper
with az-index
that should position it above.spectrum-Underlay
. It also adds/removes classes indialog.yml
to better implement the open/close behaviors.Note: The hero, no-divider, and dismissible dialogs are now closed on page load, as opposed to being open previously.
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
@jawinn
yarn run dev
and visit the dialog docs pageis-open
class tospectrum-Modal
andspectrum-Modal-wrapper
spectrum-CSSExample-modal
should be2 !important
to ensure it remains above thez-index: 1 !important
set onspectrum-Underlay
.is-open
from those same modal elementsRegression testing
Validate:
Screenshots
To-do list