Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 660826b

Browse files
topherfangiohansl
authored andcommitted
fix(layout): Revert overzealous IE11 flexbox fix. (#9412)
A recent change which was supposed to fix an IE11 bug accidentally altered the `flex-basis` for the flex children of all `.layout-column` flex containers in all browsers. Unfortunately, there is no IE11-specific fix. - Revert the original change. - Update the Layout Troubleshooting page with a new demo. - Update the Layout Children docs to mention the new demo. - Remove old Chrome-specific demo which was incidentally fixed by reverting this change. Reverts ce0ebbf. Fixes #9354.
1 parent 0d2386c commit 660826b

File tree

3 files changed

+65
-70
lines changed

3 files changed

+65
-70
lines changed

docs/app/partials/layout-children.tmpl.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,14 @@ <h3>Additional Flex Values</h3>
131131
<table class="md-api-table">
132132
<tr>
133133
<td>flex</td>
134-
<td>Will grow and shrink as needed. Starts with a size of 0%. Same as <code>flex="0"</code>.</td>
134+
<td>
135+
Will grow and shrink as needed. Starts with a size of 0%. Same as <code>flex="0"</code>.
136+
<br />
137+
<br />
138+
<b>Note:</b> There is a known bug with this attribute in IE11 when the parent container has
139+
no explicit height set. See our
140+
<a ng-href="layout/tips#layout-column-0px-ie11">Troubleshooting</a> page for more info.
141+
</td>
135142
</tr>
136143
<tr>
137144
<td>flex="none"</td>

docs/app/partials/layout-tips.tmpl.html

Lines changed: 57 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -108,98 +108,92 @@ <h3>Layout Column</h3>
108108
<br/>
109109
<hr/>
110110

111-
<h3>Layout Column and Container Heights</h3>
111+
<h3 id="layout-column-0px-ie11">IE11 - Layout Column, 0px Height</h3>
112112

113113
<p>
114-
In Flexbox, some browsers will determine size of the flex containers based on the size of their
115-
content. This is particularly noticable if you have a non-flex item (say a toolbar), followed by
116-
two flex items in a column layout.
114+
In Internet Explorer 11, when you have a column layout with unspecified height and flex items
115+
inside, the browser can get confused and incorrectly calculate the height of each item (and thus
116+
the container) as <code>0px</code>, making the items overlap and not take up the proper amount
117+
of space.
117118
</p>
118119

119-
<docs-demo demo-title="Flex Height - Odd (Chrome )" class="small-demo colorNested">
120-
<demo-file name="index.html">
121-
<div layout="column" style="height: 450px !important;">
122-
<div style="height: 50px;">Toolbar</div>
123-
124-
<div flex layout="column" style="overflow: auto;">
125-
<md-content flex layout-margin>
126-
<p>Flex with smaller content...</p>
127-
128-
<p ng-repeat="i in [0,1,2,3,4]">Line {{i}}</p>
129-
</md-content>
120+
<p class="layout_note">
121+
<b>Note:</b> The flex items below actually do have some height. This is because our doc-specific
122+
CSS provides a small bit of padding (<code>8px</code>). We felt that the extra padding made for
123+
a better demo of the actual issue.
124+
</p>
130125

131-
<md-content flex layout-margin>
132-
<p>
133-
Flex with larger content...
134-
</p>
126+
<docs-demo demo-title="IE11 - Layout Column, 0px Height" class="colorNested">
127+
<demo-file name="index.html">
128+
<div flex layout="column">
129+
<div flex>
130+
11111<br />11111<br />11111
131+
</div>
135132

136-
<p ng-repeat="i in [0,1,2,3,4]">Line {{i}}</p>
133+
<div flex>
134+
22222<br />22222<br />22222
135+
</div>
137136

138-
<div id="toHide">
139-
<p ng-repeat="i in [5,6,7,8,9]">Line {{i}}</p>
140-
</div>
141-
</md-content>
137+
<div flex>
138+
33333<br />33333<br />33333
142139
</div>
143140
</div>
144141
</demo-file>
145142
</docs-demo>
146143

147144
<p>
148-
Notice how in Chrome the second scrollable area is nearly twice as tall as the first. This is
149-
because we are using nested flex items and the contents of the second
150-
<code>&lt;md-content&gt;</code> are twice as large as the first. Try clicking the button below
151-
to toggle the light blue box; this will make the containers the same size.
152-
</p>
153-
154-
<p layout="row" layout-align="center center">
155-
<md-button class="md-raised" ng-click="tips.toggleContentSize()">
156-
{{tips.toggleButtonText}} Blue Box
157-
</md-button>
158-
</p>
159-
160-
<p>
161-
In order to fix this, we must specify the height of the outer flex item. The easiest way to
162-
achieve this is to simply set the height to <code>100%</code>. When paired with the
163-
<code>flex</code> attribute, this achieves the desired result.
145+
Unfortunately, there is no IE11 specific fix available, and the suggested workaround is to set
146+
the <code>flex-basis</code> property to <code>auto</code> instead of <code>0px</code> (which is
147+
the default setting).
164148
</p>
165149

166150
<p>
167-
<em>
168-
<strong>Note:</strong> When <code>height: 100%</code> is used without the <code>flex</code>
169-
attribute, the container will take up as much space as available and squish the toolbar which
170-
has been set to a height of <code>50px</code>.
171-
</em>
151+
You can easily achieve this using the <code>flex="auto"</code> attribute that the Layout system
152+
provides.
172153
</p>
173154

174-
<docs-demo demo-title="Chrome Flex Height - Fixed" class="small-demo colorNested">
155+
<docs-demo demo-title="IE11 - Layout Column, 0px Height (Fix 1)" class="colorNested">
175156
<demo-file name="index.html">
176-
<div layout="column" style="height: 450px !important;">
177-
<div style="height: 50px;">Toolbar</div>
157+
<div flex layout="column">
158+
<div flex="auto">
159+
11111<br />11111<br />11111
160+
</div>
178161

179-
<div flex layout="column" style="overflow: auto; height: 100%;">
180-
<md-content flex layout-margin>
181-
<p>Flex with smaller content...</p>
162+
<div flex="auto">
163+
22222<br />22222<br />22222
164+
</div>
182165

183-
<p ng-repeat="i in [0,1,2,3,4]">Line {{i}}</p>
184-
</md-content>
166+
<div flex="auto">
167+
33333<br />33333<br />33333
168+
</div>
169+
</div>
170+
</demo-file>
171+
</docs-demo>
185172

186-
<md-content flex layout-margin>
187-
<p>
188-
Flex with larger content...
189-
</p>
190173

191-
<p ng-repeat="i in [0,1,2,3,4]">Line {{i}}</p>
174+
<p>
175+
Alternatively, you can manually set the height of the layout container (<code>400px</code>
176+
in the demo below).
177+
</p>
192178

193-
<div>
194-
<p ng-repeat="i in [5,6,7,8,9]">Line {{i}}</p>
195-
</div>
196-
</md-content>
179+
<docs-demo demo-title="IE11 - Layout Column, 0px Height (Fix 2)" class="colorNested">
180+
<demo-file name="index.html">
181+
<div flex layout="column" style="height: 400px;">
182+
<div flex>
183+
11111<br />11111<br />11111
184+
</div>
185+
186+
<div flex>
187+
22222<br />22222<br />22222
188+
</div>
189+
190+
<div flex>
191+
33333<br />33333<br />33333
197192
</div>
198193
</div>
199194
</demo-file>
200195
</docs-demo>
201196

202-
203197
<br/>
204198
<hr/>
205199

src/core/style/layout.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,3 @@
436436
@include flex-properties-for-name($name);
437437
@include layout-for-name($name);
438438
}
439-
440-
/* IE10-IE11 column-flex bug fix (set proper default value) */
441-
.layout-column > .flex {
442-
-ms-flex-basis: auto;
443-
flex-basis: auto;
444-
}

0 commit comments

Comments
 (0)