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

Conversation

josemigallas
Copy link
Contributor

@josemigallas josemigallas commented Jul 11, 2019

What this PR does / why we need it:

After introducing PF4 React in vert nav, the header is showing some weird styles due to Patternfly variables.

In order to fix this, it is required to use !important in our _patternfly_ie11.scss.

Before:
header

After:
header_after

Which issue(s) this PR fixes
THREESCALE-3013: Header changes color when on small screen setup

Verification steps

  • Go to a screen where there's a Vertical Navigation (e.g. Audience)
  • Shrink browser and look at the Header's nav component. Background and margins should stay unchanged.

@josemigallas josemigallas added the Priority: High Closes a JIRA issue in our sprint label Jul 11, 2019
@josemigallas josemigallas self-assigned this Jul 11, 2019
@hallelujah
Copy link
Contributor

@josemigallas It would be nice to have before/after screenshot ;)

@@ -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...

@didierofrivia didierofrivia merged commit fe854cb into master Jul 16, 2019
@didierofrivia didierofrivia deleted the fix/THREESCALE-3013_header branch July 16, 2019 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Closes a JIRA issue in our sprint
Projects
None yet
4 participants