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

Fixes Header on small screen setup #990

Merged
merged 1 commit into from
Jul 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/assets/stylesheets/provider/_patternfly_ie11.scss
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ button:-moz-focusring,
-ms-grid-row-span: 1;
grid-row: 2 / 3;
min-width: 0;
padding-left: 0;
background-color: transparent;
padding-left: 0 !important; // Need to override styles introduced by PF React
Copy link
Contributor

Choose a reason for hiding this comment

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

Or loading this after PF React won't do?
Or using more precise css rules?

Copy link
Contributor

Choose a reason for hiding this comment

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

@josemigallas This file is called _patternfly_ie11.scss. I'd expect is loaded only when using IE11 but is imported in app/assets/stylesheets/provider/_theme.scss. We shouldn't load this file if unnecessary.
This style is only needed in IE11?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hallelujah It's more complex than that. The problem is using PF react and rails. Rails styles are load first in a big bundle, after that React loads its own styles and put them inline. This means there is no way to load this style after PF react (that would be the ideal solution).

It would be possible to add these styles by React, in a different styles.scss file but I think leaving it here in _patternfly_ie11.scss makes it more maintainable. In the end the file itself is a hacky workaround and it will be removed when we drop IE11 support.

Adding a more precise rule could be possible (I guess) but I think this way the intent is clearer and again, it is a hack already.

@damianpm It is not. These contains all PF4 styles necessary for the Page, Header and Vertical Navigation, that are also compatible with IE11. This was discussed and introduced in #859. And it's the official Patternfly way according to this wiki.

It could have been named patternfly_ie11_compatible.scss to avoid confusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, then we should rename it.
What about importing this file from webpack, after DOMContentLoaded, have you tried?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Styles will be broken if JS is disabled then. This file has to be there..

Copy link
Contributor

@damianpm damianpm Jul 12, 2019

Choose a reason for hiding this comment

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

Well if js is disabled everything will be broken. But is not big deal, I can live with this file where it is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well that's not entirely accurate. The relevant components (Page, Header, Nav) won't be broken and neither will be most of the content generated by rails, an example:
Screen Shot 2019-07-12 at 12 03 55

Copy link
Contributor

Choose a reason for hiding this comment

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

There is no context selector :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Obviously a big amount of features won't work without JS but that doesn't mean everything is broken. Lacking functionality should be implemented accordingly to progressive enhancement, if they are really necessary. Having JS disabled is an edge case but if we are able to minimize the damage...

background-color: transparent !important; // Need to override styles introduced by PF React
}

.pf-c-page__header-nav > .pf-c-nav {
Expand Down