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(zindex): reorder indexes and remove some. #1901

Merged
merged 5 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/patternfly/components/AboutModalBox/about-modal-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Component variables
--pf-c-about-modal-box--BackgroundColor: #{$pf-color-black-1000}; // Modal uses a non-standard background color
--pf-c-about-modal-box--BoxShadow: 0 0 100px 0 rgba(255, 255, 255, .05); // This is a special one-off glow for the about modal
--pf-c-about-modal-box--ZIndex: var(--pf-global--ZIndex--2xl);
--pf-c-about-modal-box--ZIndex: var(--pf-global--ZIndex--xl);
--pf-c-about-modal-box--Height: 100%;
--pf-c-about-modal-box--lg--Height: #{pf-size-prem(762px)}; // Height is optimized for the exact height desired
--pf-c-about-modal-box--lg--MaxHeight: calc(100% - var(--pf-global--spacer--xl)); // MaxHeight ensures that the modal will not go off the screen and instead the content will scroll
Expand Down Expand Up @@ -199,7 +199,6 @@
grid-area: close;
position: sticky;
top: 0;
z-index: var(--pf-c-about-modal-box__close--ZIndex);
display: flex;
align-items: flex-start;
justify-content: flex-end;
Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/AppLauncher/app-launcher.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
--pf-c-app-launcher__menu--PaddingTop: var(--pf-global--spacer--sm);
--pf-c-app-launcher__menu--PaddingBottom: var(--pf-global--spacer--sm);
--pf-c-app-launcher__menu--Top: calc(100% + var(--pf-global--spacer--xs));
--pf-c-app-launcher__menu--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-app-launcher__menu--ZIndex: var(--pf-global--ZIndex--sm);

// Expanded
--pf-c-app-launcher__toggle--PaddingTop: var(--pf-global--spacer--form-element);
Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/Backdrop/backdrop.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.pf-c-backdrop {
--pf-c-backdrop--ZIndex: var(--pf-global--ZIndex--2xl);
--pf-c-backdrop--ZIndex: var(--pf-global--ZIndex--lg);
--pf-c-backdrop--Color: var(--pf-global--BackgroundColor--dark-transparent-100);
--pf-c-backdrop--BackdropFilter: blur(10px);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

// Menu
--pf-c-context-selector__menu--Top: calc(100% + var(--pf-global--spacer--xs));
--pf-c-context-selector__menu--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-context-selector__menu--ZIndex: var(--pf-global--ZIndex--sm);
--pf-c-context-selector__menu--PaddingTop: var(--pf-global--spacer--sm);
--pf-c-context-selector__menu--BackgroundColor: var(--pf-global--BackgroundColor--light-100);
--pf-c-context-selector__menu--BorderWidth: var(--pf-global--BorderWidth--sm);
Expand Down
1 change: 0 additions & 1 deletion src/patternfly/components/DataList/data-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
position: absolute;
top: var(--pf-c-data-list__item--before--Top);
left: 0;
z-index: var(--pf-c-data-list__item--before--ZIndex);
width: var(--pf-c-data-list__item--before--Width);
height: var(--pf-c-data-list__item--before--Height);
content: "";
Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/Dropdown/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
--pf-c-dropdown__menu--PaddingTop: var(--pf-global--spacer--sm);
--pf-c-dropdown__menu--PaddingBottom: var(--pf-global--spacer--sm);
--pf-c-dropdown__menu--Top: calc(100% + var(--pf-global--spacer--xs)); // The top of the menu must be pushed down to create space between the toggle and menu
--pf-c-dropdown__menu--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-dropdown__menu--ZIndex: var(--pf-global--ZIndex--sm);
--pf-c-dropdown--m-top__menu--Top: 0;
--pf-c-dropdown--m-top__menu--Transform: translateY(calc(-100% - var(--pf-global--spacer--xs))); // The "dropup" menu must be transformed up and this calculates how much to create space between the toggle and menu

Expand Down
1 change: 0 additions & 1 deletion src/patternfly/components/FormControl/form-control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ $pf-c-form-control__select--ViewBox: "320" !default;
// This component always needs to be light
@include pf-t-light;

position: relative;
width: 100%;
padding: var(--pf-c-form-control--PaddingTop) var(--pf-c-form-control--PaddingRight) var(--pf-c-form-control--PaddingBottom) var(--pf-c-form-control--PaddingLeft);
font-size: var(--pf-c-form-control--FontSize);
Expand Down
5 changes: 0 additions & 5 deletions src/patternfly/components/InputGroup/input-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@
/* stylelint-enable */

.pf-c-form-control {
position: static;

&[aria-invalid="true"] {
position: relative;
z-index: var(--pf-c-input-group--c-form-control--invalid--ZIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this has to do with the old border issue when the design was different. @mcoker might have some insight on this too. I'd say we can remove position:relative; here too if we aren't including a z-index.

Copy link
Contributor

Choose a reason for hiding this comment

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

yep it was from when the error input had a red border all around, and if you had, say, a dropdown + invalid input in an input group, the right border from the dropdown hid the red left border on the input. Agreed, don't think we need position: relative; here. I also don't think we need position: relative on .pf-c-form-control. Assuming we can remove that, we can also remove position: static from .pf-c-input-group .pf-c-form-control

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah when I remove position: static from .pf-c-input-group .pf-c-form-control we get this:

Screen Shot 2019-06-07 at 1 47 25 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

so going to keep that in :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you also remove position: relative from .pf-c-form-control?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed thanks, didnt realize you meant from that component


&:not(:last-child) {
margin-right: var(--pf-c-input-group--c-form-control--MarginRight);
}
Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/ModalBox/modal-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--pf-c-modal-box--PaddingLeft: var(--pf-global--spacer--xl);
--pf-c-modal-box--BorderSize: var(--pf-global--BorderWidth--sm);
--pf-c-modal-box--BoxShadow: var(--pf-global--BoxShadow--lg);
--pf-c-modal-box--ZIndex: var(--pf-global--ZIndex--2xl);
--pf-c-modal-box--ZIndex: var(--pf-global--ZIndex--xl);
--pf-c-modal-box--Width: 100%;
--pf-c-modal-box--MaxWidth: calc(100% - var(--pf-global--spacer--xl)); // Ensure modal has gutters at full width
--pf-c-modal-box--m-sm--sm--MaxWidth: #{pf-size-prem(560px)}; // MaxWidth is based on optimal line length for reading
Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/Nav/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

// Scroll button
--pf-c-nav__scroll-button--Top: var(--pf-global--spacer--sm);
--pf-c-nav__scroll-button--ZIndex: var(--pf-global--ZIndex--md);
--pf-c-nav__scroll-button--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-nav__scroll-button--Width: var(--pf-global--spacer--xl);
--pf-c-nav__scroll-button--Height: #{pf-size-prem(40px)};
--pf-c-nav__scroll-button--PaddingRight: var(--pf-global--spacer--sm);
Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/OptionsMenu/options-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
--pf-c-options-menu__menu--PaddingTop: var(--pf-global--spacer--sm);
--pf-c-options-menu__menu--PaddingBottom: var(--pf-global--spacer--sm);
--pf-c-options-menu__menu--Top: calc(100% + var(--pf-global--spacer--xs));
--pf-c-options-menu__menu--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-options-menu__menu--ZIndex: var(--pf-global--ZIndex--sm);
--pf-c-options-menu--m-top__menu--Top: 0;
--pf-c-options-menu--m-top__menu--Transform: translateY(calc(-100% - var(--pf-global--spacer--xs))); // The "dropup" menu must be transformed up and this calculates how much to create space between the toggle and menu

Expand Down
2 changes: 1 addition & 1 deletion src/patternfly/components/Select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
--pf-c-select__menu--PaddingTop: var(--pf-global--spacer--sm);
--pf-c-select__menu--PaddingBottom: var(--pf-global--spacer--sm);
--pf-c-select__menu--Top: calc(100% + var(--pf-global--spacer--xs)); // The top of the menu must be pushed down to create space between the toggle and menu
--pf-c-select__menu--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-select__menu--ZIndex: var(--pf-global--ZIndex--sm);
--pf-c-select__menu--m-top--Transform: translateY(calc(-100% - var(--pf-global--spacer--xs))); // The "dropup" menu must be transformed up and this calculates how much to create space between the toggle and menu

// Menu item
Expand Down
1 change: 0 additions & 1 deletion src/patternfly/components/Table/table-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@
top: 0;
bottom: 0;
left: 0;
z-index: 10;
width: var(--pf-c-table__expandable-row--before--Width);
content: "";
}
Expand Down
2 changes: 0 additions & 2 deletions src/patternfly/components/Table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@
top: var(--pf-c-table__expandable-row--before--Top);
bottom: var(--pf-c-table__expandable-row--before--Bottom);
left: 0;
z-index: var(--pf-c-table__expandable-row--before--ZIndex);
width: var(--pf-c-table__expandable-row--before--Width);
content: "";

Expand Down Expand Up @@ -334,7 +333,6 @@
top: calc(var(--pf-c-table--BorderWidth) * -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed a typo at https://github.com/patternfly/patternfly-next/pull/1901/files#diff-cc8438917ce7d4aaec059eff02f314ddR319 Table toggle compount -> compound. Would you mind fixing that?

right: 0;
left: 0;
z-index: 999;
content: "";
border-top: var(--pf-c-table__compound-expansion-toggle--BorderTop--BorderWidth) solid var(--pf-c-table__compound-expansion-toggle--BorderTop--BorderColor);
}
Expand Down
3 changes: 1 addition & 2 deletions src/patternfly/components/Tabs/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

// Scroll buttons
--pf-c-tabs__scroll-button--Width: var(--pf-global--spacer--xl);
--pf-c-tabs__scroll-button--ZIndex: var(--pf-global--ZIndex--md);
--pf-c-tabs__scroll-button--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-tabs__scroll-button--m-secondary--hover--Color: var(--pf-global--active-color--100);
--pf-c-tabs__scroll-button--m-secondary--hover--Color: var(--pf-global--active-color--100);
--pf-c-tabs__scroll-button--m-secondary-right--m-start-current--Color: var(--pf-global--active-color--100);
Expand Down Expand Up @@ -137,7 +137,6 @@

// Tab item current state
&.pf-m-current .pf-c-tabs__button {
z-index: var(--pf-c-tabs__item--m-current--ZIndex);
color: var(--pf-c-tabs__item--m-current--Color);

&::before {
Expand Down
10 changes: 8 additions & 2 deletions src/patternfly/components/Wizard/wizard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

// Header
--pf-c-wizard__header--BackgroundColor: var(--pf-global--BackgroundColor--dark-100);
--pf-c-wizard__header--ZIndex: var(--pf-global--ZIndex--md);
--pf-c-wizard__header--PaddingTop: var(--pf-global--spacer--lg);
--pf-c-wizard__header--PaddingRight: var(--pf-global--spacer--md);
--pf-c-wizard__header--PaddingBottom: var(--pf-global--spacer--lg);
Expand Down Expand Up @@ -70,7 +71,7 @@

// Toggle
--pf-c-wizard__toggle--BackgroundColor: var(--pf-global--BackgroundColor--100);
--pf-c-wizard__toggle--ZIndex: var(--pf-global--ZIndex--sm);
--pf-c-wizard__toggle--ZIndex: var(--pf-global--ZIndex--md);
--pf-c-wizard__toggle--BoxShadow: var(--pf-global--BoxShadow--md-bottom);
--pf-c-wizard__toggle--PaddingTop: var(--pf-global--spacer--lg);
--pf-c-wizard__toggle--PaddingRight: var(--pf-global--spacer--md);
Expand All @@ -97,7 +98,7 @@
--pf-c-wizard__toggle-icon--MarginTop: #{pf-size-prem(6px)};

// Nav
--pf-c-wizard__nav--ZIndex: var(--pf-global--ZIndex--xs);
--pf-c-wizard__nav--ZIndex: var(--pf-global--ZIndex--sm);
--pf-c-wizard__nav--BackgroundColor: var(--pf-global--BackgroundColor--100);
--pf-c-wizard__nav--BoxShadow: var(--pf-global--BoxShadow--md-bottom);
--pf-c-wizard__nav--lg--BoxShadow: var(--pf-global--BoxShadow--lg-right);
Expand Down Expand Up @@ -131,6 +132,9 @@
--pf-c-wizard__outer-wrap--BackgroundColor: var(--pf-global--BackgroundColor--100);
--pf-c-wizard__outer-wrap--lg--PaddingLeft: var(--pf-c-wizard__nav--lg--Width);

// Main
--pf-c-wizard__main--ZIndex: var(--pf-global--ZIndex--xs);
Copy link
Contributor

Choose a reason for hiding this comment

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

This z-index didn't seem to affect anything when testing locally, do we need it?

Copy link
Contributor

Choose a reason for hiding this comment

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

We have the same thing on the page component's main section. I think it's useful just to make sure the main section has a lower z-index than the rest of the sections, so if someone adds something in the main section with z-index: 999999999;, it will only be relative to the main section and won't show above the header/nav.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. In that case, .pf-c-wizard__header should also have a z-index.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we can, not sure if it's necessary. In the previous comment, I was combining the concepts of the page component (header/sidebar/main) and the wizard (toggle/nav/main) because of the stacking order needed for the layout, so it may have come across wrong. The z-index on main in the page component isn't necessarily to keep things from main displaying on top of the header (which isn't clear from what I said :D), but more for ensuring anything like a dropdown menu that originates from the header will always appear on top of whatever is in the main section. In the case of the wizard, we don't have that kind of need. I think the main concern in wizard is that we want to make sure nothing from main displays above the nav when it's expanded (on mobile). Then the toggle needs to display on top of nav because of the toggle's drop shadow, which is why it has the highest z-index.

Copy link
Contributor

Choose a reason for hiding this comment

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

I read you. In the case that someone does something crazy with z-indexing and absolute positioning, say for a button, this might happen. It's the same concept as page component and an edge case for sure, so ¯_(ツ)_/¯

Screen Shot 2019-06-12 at 12 10 41 PM

Looks good to me either way 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah gotcha! Agree that it's an edge case, but adding the same z-index that is on the toggle to the header would be more consistent with the page component and there is no downside that I can think of anyways, and it addresses this scenario. Good call.

Copy link
Member Author

Choose a reason for hiding this comment

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


// Body
--pf-c-wizard__main-body--PaddingTop: var(--pf-global--spacer--md);
--pf-c-wizard__main-body--PaddingRight: var(--pf-global--spacer--md);
Expand Down Expand Up @@ -211,6 +215,7 @@
@include pf-t-dark;

position: relative;
z-index: var(--pf-c-wizard__header--ZIndex);
padding: var(--pf-c-wizard__header--PaddingTop) var(--pf-c-wizard__header--PaddingRight) var(--pf-c-wizard__header--PaddingBottom) var(--pf-c-wizard__header--PaddingLeft);
background-color: var(--pf-c-wizard__header--BackgroundColor);

Expand Down Expand Up @@ -452,6 +457,7 @@
}

.pf-c-wizard__main {
z-index: var(--pf-c-wizard__main--ZIndex);
mattnolting marked this conversation as resolved.
Show resolved Hide resolved
flex: 1 1 auto;
overflow-x: hidden;
overflow-y: auto;
Expand Down