[IE9] Layout flex-box adjustments

Minor visual fix for IE9 for modern mode with search not in header.
i.e. with these settings:

    $wgVectorIsSearchInHeader = false;
    $wgVectorDefaultSkinVersion = 2;

Slight refactor of CSS. Removes block of styles that "reset" floats.
These were uneccessary because as flex-children, the floats were
ignored on those elements anyway.

Moves flex-wrap on .mw-header from layout-search-header.less
to layout-default.less since that's where display:flex is defined
and the rule is general enough that it should apply for different layouts.

Remove the @supports block with the `float:none;`. That is unnecessary
because flex-children are not affected by floats.

Change-Id: Ida3d2a7bc2b2f70238129df876714228fe5cdf84
This commit is contained in:
Jan Drewniak 2020-09-01 14:28:39 +02:00 committed by Jdlrobson
parent a8cfbe5e84
commit df3954eff8
2 changed files with 6 additions and 28 deletions

View file

@ -54,6 +54,7 @@ body {
// Vertical centering of header elements (IE>=11), requires flex. // Vertical centering of header elements (IE>=11), requires flex.
// Non-flex fallback for IE<=9: float rule on the child elements. // Non-flex fallback for IE<=9: float rule on the child elements.
.flex-display(); .flex-display();
flex-wrap: wrap;
// https://caniuse.com/#search=align-items // https://caniuse.com/#search=align-items
align-items: center; align-items: center;
z-index: @z-index-header; z-index: @z-index-header;
@ -153,6 +154,7 @@ body {
} }
#mw-sidebar-button { #mw-sidebar-button {
float: left; // Browser: IE9 support - button as flex-child fallback.
margin-left: -@margin-horizontal-sidebar-button-icon; margin-left: -@margin-horizontal-sidebar-button-icon;
margin-right: @margin-horizontal-sidebar-button-icon; // Accidentally the same. margin-right: @margin-horizontal-sidebar-button-icon; // Accidentally the same.
} }

View file

@ -29,6 +29,9 @@
// Header components // Header components
#p-search { #p-search {
flex-grow: 1;
// Support IE9: float will be disabled if display flex is supported
float: left;
// Override values to reflect new behaviour. // Override values to reflect new behaviour.
min-width: @min-width-search; min-width: @min-width-search;
max-width: 100%; max-width: 100%;
@ -40,13 +43,8 @@
} }
} }
// Support IE9: float will be disabled if display flex is supported
#p-search,
#mw-sidebar-button {
float: left;
}
#p-personal { #p-personal {
flex-grow: 1;
text-align: right; text-align: right;
flex-basis: @min-width-personal-tools; flex-basis: @min-width-personal-tools;
margin-left: @margin-horizontal-search; margin-left: @margin-horizontal-search;
@ -55,25 +53,3 @@
float: right; float: right;
} }
} }
// If flexbox supported reset the floats that are supporting IE9
// When IE9 is no longer supported this entire query can be dropped.
@supports ( display: flex ) {
.skin-vector-search-header {
.mw-header {
flex-wrap: wrap;
}
#p-personal,
#p-search {
flex-grow: 1;
// Disable the float: left rule for IE9 support
float: none;
}
#mw-sidebar-button {
// Disable the float: left rule for IE9 support
float: none;
}
}
}