Skip to content

Commit d99e9f1

Browse files
castastropheheyMPgithub-actions[bot]
authored
fix: Content set hold rendering until upgrade, prefixed attribute support for overflow property in cards (#1427)
* fix: Fixing the cascade of the alignment * fix: Writing tests * fix: Add new tests * fix: Manually set properties * fix: Fix build error * fix: Additional tests * fix: Remove auto-import; darn you VSCode * fix: Update tests * fix: Comment out React tests for attributes * fix: Final updates * fix: Revert demo update * fix: Remove comments for debugging * fix: Update changelog * fix: Add align overrides and set a skip on the tests failing for react * feat: Docker image config * updated spandix default settings. * fix: Working through test errors * fix: Try skipping the test suite again * fix: Update test * fix: Updating error related to tdd and bdd * fix: Update syntax * fix: Update postbuild * fix: Fix react skip logic * fix: Update mix bdd errors * fix: Use a before each * fix: Use describe instead of suite * fix: Revert unrelated updates * fix: Setup * fix: Skip react and vue * fix: Remove extra escape hooks * fix: Fix width error in tests * fix: Revert unneeded file updates * fix: Move fixture to setup * fix: Test adding back in react and vue * fix: Replace done with skip * fix: React skip attribute suite * fix: Skip react & vue when using test fixtures * fix: Push up working fixes * Fix content set cascading attributes alt (#1420) * fix: Fix IE11 bug! Upgraded elements being hidden by the light DOM content * fix: Prettier formatting existing items * fix: Revert unnecessary updates * Remove unneeded log outputs in pfelement * fix: updating tests * fix: Remove unused connect method * fix: Add back content reference for non-IE envs * fix: Fix resize error * fix: Add check that this.view exists before fetching tag * fix: Fixing issues found in branch testing * Apply suggestions from code review * fix: Update tests to use customElements.whenDefined instead of customElements.define * fix: Fix appendChild error from test suite * fix: Append new header/panel to content set not rendered element * fix: Adding comment to pfelement; new test for propogation of attributes * fix: Update attributes in React & Vue markup * fix: Commented out disclosure test because that seems to be a bug in pfe-accordion * fix: Update baselines * fix: Add prefixing to card styles, fix propagation bug in content-set (AGAIN) using delayRender * fix: Remove debug flag * fix: Update changelog * fix: Remove logging * fix: Fix for failing test; view -> this.viewAll Co-authored-by: heyMP <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a174af0 commit d99e9f1

File tree

5 files changed

+47
-34
lines changed

5 files changed

+47
-34
lines changed

CHANGELOG-1.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.3.2 (2021-03-04)
2+
3+
- [](https://github.com/patternfly/patternfly-elements/commit/) fix: Content set hold rendering until upgrade, prefixed attribute support for overflow property in cards
4+
15
# 1.3.1 (2021-03-03)
26

37
- [eaf0e25](https://github.com/patternfly/patternfly-elements/commit/eaf0e256a525833e4cb3a36a51cf78c73c44867d) fix: Content set bug with cascading attributes in UMD assets

elements/pfe-card/src/pfe-card.scss

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ $size-small: (
111111
&__header,
112112
&__body,
113113
&__footer {
114-
::slotted([overflow~="top"]),
114+
::slotted([pfe-overflow~="top"]),
115115
::slotted([overflow~="top"]) {
116116
z-index: 1;
117117
margin-top: -2rem; //IE11 fallback
@@ -121,20 +121,20 @@ $size-small: (
121121
}
122122
}
123123

124-
::slotted([overflow~="right"]),
124+
::slotted([pfe-overflow~="right"]),
125125
::slotted([overflow~="right"]) {
126126
margin-right: -2rem; //IE11 fallback
127127
margin-right: calc(-1 * #{pfe-local(PaddingRight)});
128128
}
129129

130-
::slotted([overflow~="bottom"]),
130+
::slotted([pfe-overflow~="bottom"]),
131131
::slotted([overflow~="bottom"]) {
132132
margin-bottom: -2rem; //IE11 fallback
133133
margin-bottom: calc(-1 * calc(#{pfe-local(PaddingBottom)} + #{pfe-local(BorderRadius)}));
134134
align-self: flex-end;
135135
}
136136

137-
::slotted([overflow~="left"]),
137+
::slotted([pfe-overflow~="left"]),
138138
::slotted([overflow~="left"]) {
139139
margin-left: -2rem; //IE11 fallback
140140
margin-left: calc(-1 * #{pfe-local(PaddingLeft)});
@@ -146,29 +146,29 @@ $size-small: (
146146
object-fit: cover; // Fix distortion
147147
}
148148

149-
::slotted(img:not[overflow]),
149+
::slotted(img:not[pfe-overflow]),
150150
::slotted(img:not[overflow]) {
151151
align-self: flex-start; //Don't stretch image 100% with other Flexbox items in card.
152152
}
153153

154-
::slotted(img[overflow]),
154+
::slotted(img[pfe-overflow]),
155155
::slotted(img[overflow]) {
156156
max-width: unset !important;
157157
}
158158

159-
::slotted(img[overflow~="right"]),
159+
::slotted(img[pfe-overflow~="right"]),
160160
::slotted(img[overflow~="right"]) {
161161
width: calc(100% + 2rem) !important; //IE11 fallback
162162
width: calc(100% + #{pfe-local(PaddingRight)}) !important;
163163
}
164164

165-
::slotted(img[overflow~="left"]),
165+
::slotted(img[pfe-overflow~="left"]),
166166
::slotted(img[overflow~="left"]) {
167167
width: calc(100% + 2rem) !important; //IE11 fallback
168168
width: calc(100% + #{pfe-local(PaddingLeft)}) !important;
169169
}
170170

171-
::slotted(img[overflow~="right"][overflow~="left"]),
171+
::slotted(img[pfe-overflow~="right"][pfe-overflow~="left"]),
172172
::slotted(img[overflow~="right"][overflow~="left"]) {
173173
width: calc(100% + 4rem) !important; //IE11 fallback
174174
width: calc(100% + #{pfe-local(PaddingRight)} + #{pfe-local(PaddingLeft)}) !important;
@@ -204,7 +204,7 @@ $size-small: (
204204
margin-bottom: pfe-local(PaddingBottom);
205205
}
206206

207-
::slotted([overflow~="top"]),
207+
::slotted([pfe-overflow~="top"]),
208208
::slotted([overflow~="top"]) {
209209
--pfe-card__overflow--MarginTop: calc(#{pfe-local(PaddingTop)} * -1);
210210
}
@@ -213,12 +213,12 @@ $size-small: (
213213
display: none;
214214
}
215215

216-
:host([has_body],[has_footer]) & ::slotted([overflow~="bottom"]),
216+
:host([has_body],[has_footer]) & ::slotted([pfe-overflow~="bottom"]),
217217
:host([has_body],[has_footer]) & ::slotted([overflow~="bottom"]) {
218218
--pfe-card__overflow--MarginBottom: calc(#{pfe-local(spacing--vertical)} * -1);
219219
}
220220

221-
::slotted([overflow~="bottom"]),
221+
::slotted([pfe-overflow~="bottom"]),
222222
::slotted([overflow~="bottom"]) {
223223
--pfe-card__overflow--MarginBottom: calc(#{pfe-local(PaddingBottom)} * -1);
224224
}
@@ -230,23 +230,23 @@ $size-small: (
230230
}
231231
}
232232
&__body {
233-
:host(:not([has_header])) & ::slotted([overflow~="top"]),
233+
:host(:not([has_header])) & ::slotted([pfe-overflow~="top"]),
234234
:host(:not([has_header])) & ::slotted([overflow~="top"]) {
235235
--pfe-card__overflow--MarginTop: calc(#{pfe-local(PaddingTop)} * -1);
236236
}
237237

238-
::slotted([overflow~="top"]),
238+
::slotted([pfe-overflow~="top"]),
239239
::slotted([overflow~="top"]) {
240240
z-index: 1;
241241
--pfe-card__overflow--MarginTop: calc(#{pfe-local(spacing--vertical)} * -1);
242242
}
243243

244-
::slotted([overflow~="bottom"]),
244+
::slotted([pfe-overflow~="bottom"]),
245245
::slotted([overflow~="bottom"]) {
246246
--pfe-card__overflow--MarginBottom: calc(#{pfe-local(PaddingBottom)} * -1);
247247
}
248248

249-
:host([has_footer]) & ::slotted([overflow~="bottom"]),
249+
:host([has_footer]) & ::slotted([pfe-overflow~="bottom"]),
250250
:host([has_footer]) & ::slotted([overflow~="bottom"]) {
251251
--pfe-card__overflow--MarginBottom: calc(#{pfe-local(spacing--vertical)} * -1);
252252
}
@@ -264,7 +264,7 @@ $size-small: (
264264
// Aligns buttons and CTAs
265265
align-items: pfe-local(AlignItems, baseline, $region: footer);
266266

267-
::slotted([overflow~="bottom"]),
267+
::slotted([pfe-overflow~="bottom"]),
268268
::slotted([overflow~="bottom"]) {
269269
--pfe-card__overflow--MarginBottom: calc(#{pfe-local(PaddingBottom)} * -1);
270270
}

elements/pfe-content-set/demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h4 pfe-content-set--header>Heading 3</h4>
220220
<br />
221221

222222
<section>
223-
<h3>Attributes: <code>vertical</code>, <code>variant</code> and <code>align</code></h3>
223+
<h3 id="attributes">Attributes: <code>vertical</code>, <code>variant</code> and <code>align</code></h3>
224224
</section>
225225
<section class="faux-container">
226226
<h2 class="label">pfe-content set with attributes <code>vertical</code> and <code>variant="wind"</code>

elements/pfe-content-set/src/pfe-content-set.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ class PfeContentSet extends PFElement {
7171
attr: "pfe-variant",
7272
alias: "variant"
7373
},
74-
tabHistory: {
75-
title: "Tab History",
76-
type: Boolean,
77-
default: false,
78-
cascade: "pfe-tabs"
79-
},
8074
// @TODO: Deprecated for 1.0
8175
oldTabHistory: {
8276
type: Boolean,
8377
alias: "tabHistory",
8478
attr: "pfe-tab-history"
8579
},
80+
tabHistory: {
81+
title: "Tab History",
82+
type: Boolean,
83+
default: false,
84+
cascade: "pfe-tabs"
85+
},
8686
//-- PFE-ACCORDION specific properties
8787
disclosure: {
8888
// Leaving this as a string since it's an opt out
@@ -210,14 +210,8 @@ class PfeContentSet extends PFElement {
210210
// If any light DOM exists, validate it meets the requirements for rendering
211211
if (this.hasLightDOM()) {
212212
let valid = false;
213-
// For non-IE environments, use assigned nodes
214-
const content = this.shadowRoot.querySelector(`slot#lightdom`);
215-
let nodes = content.assignedNodes();
216-
// Otherwise grab the direct children
217-
if (this.isIE11) nodes = [...this.children];
218-
219213
// Loop through the assigned nodes
220-
nodes.forEach(node => {
214+
[...this.children].forEach(node => {
221215
// Validate that any non-text nodes have the right attributes present
222216
// They don't have to be in the right order, just that they exist at all lets us progress
223217
if (
@@ -233,7 +227,7 @@ class PfeContentSet extends PFElement {
233227
}
234228

235229
constructor() {
236-
super(PfeContentSet, { type: PfeContentSet.PfeType });
230+
super(PfeContentSet, { type: PfeContentSet.PfeType, delayRender: true });
237231

238232
this.isIE11 = /MSIE|Trident|Edge\//.test(window.navigator.userAgent);
239233

@@ -249,6 +243,7 @@ class PfeContentSet extends PFElement {
249243

250244
this._observer = new MutationObserver(this._mutationHandler);
251245
if (window.ResizeObserver) this._resizeObserver = new ResizeObserver(this._resizeHandler);
246+
if (this.isIE11) this.render();
252247
}
253248

254249
connectedCallback() {
@@ -260,6 +255,7 @@ class PfeContentSet extends PFElement {
260255
// Validate that the light DOM data exists before building
261256
if (this.hasValidLightDOM) {
262257
this._build();
258+
if (!this.isIE11) this.render();
263259

264260
if (!this.isIE11 && window.ResizeObserver && this.parentElement) {
265261
this._resizeObserver.observe(this.parentElement);
@@ -426,6 +422,10 @@ class PfeContentSet extends PFElement {
426422
if (sets) view.appendChild(sets);
427423
}
428424

425+
// Render or re-cascade properties to the component after update
426+
if (!this._rendered) this.render();
427+
else this.cascadeProperties(this.viewAll);
428+
429429
// Wait until the tabs upgrade before setting the selectedIndex value
430430
Promise.all([customElements.whenDefined(PfeTabs.tag)]).then(() => {
431431
// pass the selectedIndex property down from pfe-content-set

elements/pfelement/src/pfelement.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ class PFElement extends HTMLElement {
367367
}
368368

369369
// If the property/attribute pair has a cascade target, copy the attribute to the matching elements
370+
// Note: this handles the cascading of new/updated attributes
370371
if (propDef.cascade) {
371372
this._copyAttribute(attr, this._pfeClass._convertSelectorsToArray(propDef.cascade));
372373
}
@@ -387,6 +388,10 @@ class PFElement extends HTMLElement {
387388
this.shadowRoot.appendChild(this.template.content.cloneNode(true));
388389

389390
this.log(`render`);
391+
392+
// Cascade properties to the rendered template
393+
this.cascadeProperties();
394+
// Reset the display context
390395
this.resetContext();
391396

392397
// If the slot definition exists, set up an observer
@@ -395,12 +400,13 @@ class PFElement extends HTMLElement {
395400
}
396401

397402
// If an observer was defined, set it to begin observing here
398-
if (this._cascadeObserver)
403+
if (this._cascadeObserver) {
399404
this._cascadeObserver.observe(this, {
400405
attributes: true,
401406
childList: true,
402407
subtree: true
403408
});
409+
}
404410

405411
this._rendered = true;
406412
}
@@ -421,7 +427,8 @@ class PFElement extends HTMLElement {
421427
}
422428

423429
/**
424-
* Handles the cascading of properties to nested components
430+
* Handles the cascading of properties to nested components when new elements are added
431+
* Attribute updates/additions are handled by the attribute callback
425432
*/
426433
cascadeProperties(nodeList) {
427434
const cascade = this._pfeClass._getCache("cascadingProperties");
@@ -526,6 +533,8 @@ class PFElement extends HTMLElement {
526533
if (mutation.type === "childList" && mutation.addedNodes.length) {
527534
this.cascadeProperties(mutation.addedNodes);
528535
}
536+
// @TODO: Do something when mutation type is attribute?
537+
// else if (mutation.type === "attributes") {}
529538
}
530539
}
531540
/* --- End observers --- */

0 commit comments

Comments
 (0)