From c7cd86d18af218f4934f2ba8cf52fc91f9a93805 Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Mon, 11 May 2020 13:49:22 -0400 Subject: [PATCH 01/12] Add d2l-expand-collapse component to create collapsable areas --- .../expand-collapse/demo/expand-collapse.html | 57 +++++++ components/expand-collapse/expand-collapse.js | 140 ++++++++++++++++++ index.html | 1 + 3 files changed, 198 insertions(+) create mode 100644 components/expand-collapse/demo/expand-collapse.html create mode 100644 components/expand-collapse/expand-collapse.js diff --git a/components/expand-collapse/demo/expand-collapse.html b/components/expand-collapse/demo/expand-collapse.html new file mode 100644 index 00000000000..a1c8d97e70e --- /dev/null +++ b/components/expand-collapse/demo/expand-collapse.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + +

Default

+ + + + +
+ + + + diff --git a/components/expand-collapse/expand-collapse.js b/components/expand-collapse/expand-collapse.js new file mode 100644 index 00000000000..86de62cc6e8 --- /dev/null +++ b/components/expand-collapse/expand-collapse.js @@ -0,0 +1,140 @@ +import { css, html, LitElement } from 'lit-element/lit-element.js'; +import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js'; +import { styleMap } from 'lit-html/directives/style-map.js'; + +const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches; + +const states = { + COLLAPSING: 'collapsing', // in the process of collapsing + COLLAPSED: 'collapsed', // fully collapsed + EXPANDING: 'expanding', // in the process of expanding + EXPANDED: 'expanded', // fully expanded +}; + +class ExpandCollapse extends LitElement { + + static get properties() { + return { + expanded: { type: Boolean, reflect: true }, + _height: { type: Number }, + _state: { type: String } + }; + } + + static get styles() { + return css` + :host { + display: block; + } + + :host([hidden]) { + display: none; + } + + .d2l-expand-collapse-container { + display: none; + height: 0px; + overflow: hidden; + transition: height 400ms cubic-bezier(0, 0.7, 0.5, 1); + } + + .d2l-expand-collapse-container:not([data-state="collapsed"]) { + display: block; + } + + .d2l-expand-collapse-container[data-state="expanded"] { + overflow: visible; + } + + /* prevent margin colapse on slotted children */ + .d2l-expand-collapse-content:before, + .d2l-expand-collapse-content:after { + content: ' '; + display: table; + } + + @media (prefers-reduced-motion: reduce) { + .d2l-expand-collapse-container { + transition: none; + } + } + `; + } + + constructor() { + super(); + this._onContentResize = this._onContentResize.bind(this); + this.expanded = false; + this._state = states.COLLAPSED; + } + + get expanded() { + return this._expanded; + } + + set expanded(val) { + const oldVal = this._expanded; + if (oldVal !== val) { + this._expanded = val; + this.requestUpdate('expanded', oldVal); + this._expandedChanged(val); + } + } + + firstUpdated() { + super.firstUpdated(); + + const content = this.shadowRoot.querySelector('.d2l-expand-collapse-content'); + this._resizeObserver = new ResizeObserver(this._onContentResize); + this._resizeObserver.observe(content); + } + + render() { + const styles = { + height: this.expanded ? `${this._height}px` : null + }; + return html` +
+
+ +
+
+ `; + } + + _expandedChanged(val) { + if (val) { + this._state = reduceMotion ? states.EXPANDED : states.EXPANDING; + this._updateHeight(); + } else { + this._state = reduceMotion ? states.COLLAPSED : states.COLLAPSING; + this._height = null; + } + } + + _getContent() { + return this.shadowRoot.querySelector('.d2l-expand-collapse-content'); + } + + _onTransitionEnd() { + if (this._state === states.EXPANDING) { + this._state = states.EXPANDED; + } else if (this._state === states.COLLAPSING) { + this._state = states.COLLAPSED; + } + } + + _onContentResize() { + if (!this.expanded) { + return; + } + this._updateHeight(); + } + + _updateHeight() { + const content = this._getContent(); + this._height = content.scrollHeight; + } + +} +customElements.define('d2l-expand-collapse', ExpandCollapse); diff --git a/index.html b/index.html index afe515bde60..79fa34d4d2a 100644 --- a/index.html +++ b/index.html @@ -57,6 +57,7 @@

Components

  • d2l-dropdown-tabs
  • +
  • d2l-expand-collapse
  • d2l-focus-trap
  • d2l-hierarchical-view
  • d2l-icon
  • From fb0dcf8def680b632e871b407fa103363cedae7f Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Mon, 11 May 2020 16:34:40 -0400 Subject: [PATCH 02/12] Misc changes: Add aria-expanded to the button in the demo as an example of how to use it. Remove px from height: 0. Use the _getContent helper instead of calling querySelector. --- components/expand-collapse/demo/expand-collapse.html | 1 + components/expand-collapse/expand-collapse.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/expand-collapse/demo/expand-collapse.html b/components/expand-collapse/demo/expand-collapse.html index a1c8d97e70e..32f3b20b2c7 100644 --- a/components/expand-collapse/demo/expand-collapse.html +++ b/components/expand-collapse/demo/expand-collapse.html @@ -45,6 +45,7 @@

    Default

    button.addEventListener('click', () => { const section = document.querySelector('d2l-expand-collapse'); section.expanded = !section.expanded; + button.setAttribute('aria-expanded', section.expanded ? 'true' : 'false'); }); diff --git a/components/expand-collapse/expand-collapse.js b/components/expand-collapse/expand-collapse.js index 86de62cc6e8..8fbd115207a 100644 --- a/components/expand-collapse/expand-collapse.js +++ b/components/expand-collapse/expand-collapse.js @@ -33,7 +33,7 @@ class ExpandCollapse extends LitElement { .d2l-expand-collapse-container { display: none; - height: 0px; + height: 0; overflow: hidden; transition: height 400ms cubic-bezier(0, 0.7, 0.5, 1); } @@ -84,7 +84,7 @@ class ExpandCollapse extends LitElement { firstUpdated() { super.firstUpdated(); - const content = this.shadowRoot.querySelector('.d2l-expand-collapse-content'); + const content = this._getContent(); this._resizeObserver = new ResizeObserver(this._onContentResize); this._resizeObserver.observe(content); } From cd323d0e041cee05f774a933cfbe45cc2e6d39ac Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Tue, 12 May 2020 09:19:07 -0400 Subject: [PATCH 03/12] Add visual diff tests --- components/expand-collapse/README.md | 0 components/expand-collapse/expand-collapse.js | 49 +++++++++---------- .../expand-collapse/test/.eslintrc.json | 3 ++ .../test/expand-collapse.visual-diff.html | 46 +++++++++++++++++ .../test/expand-collapse.visual-diff.js | 30 ++++++++++++ 5 files changed, 101 insertions(+), 27 deletions(-) create mode 100644 components/expand-collapse/README.md create mode 100644 components/expand-collapse/test/.eslintrc.json create mode 100644 components/expand-collapse/test/expand-collapse.visual-diff.html create mode 100644 components/expand-collapse/test/expand-collapse.visual-diff.js diff --git a/components/expand-collapse/README.md b/components/expand-collapse/README.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/components/expand-collapse/expand-collapse.js b/components/expand-collapse/expand-collapse.js index 8fbd115207a..353d4aabc9b 100644 --- a/components/expand-collapse/expand-collapse.js +++ b/components/expand-collapse/expand-collapse.js @@ -68,19 +68,6 @@ class ExpandCollapse extends LitElement { this._state = states.COLLAPSED; } - get expanded() { - return this._expanded; - } - - set expanded(val) { - const oldVal = this._expanded; - if (oldVal !== val) { - this._expanded = val; - this.requestUpdate('expanded', oldVal); - this._expandedChanged(val); - } - } - firstUpdated() { super.firstUpdated(); @@ -89,6 +76,12 @@ class ExpandCollapse extends LitElement { this._resizeObserver.observe(content); } + updated(changedProperties) { + if (changedProperties.has('expanded')) { + this._expandedChanged(this.expanded); + } + } + render() { const styles = { height: this.expanded ? `${this._height}px` : null @@ -102,10 +95,14 @@ class ExpandCollapse extends LitElement { `; } - _expandedChanged(val) { + async _expandedChanged(val) { if (val) { this._state = reduceMotion ? states.EXPANDED : states.EXPANDING; - this._updateHeight(); + await this.updateComplete; + const content = this._getContent(); + if (content) { + this._height = content.scrollHeight; + } } else { this._state = reduceMotion ? states.COLLAPSED : states.COLLAPSING; this._height = null; @@ -116,6 +113,16 @@ class ExpandCollapse extends LitElement { return this.shadowRoot.querySelector('.d2l-expand-collapse-content'); } + _onContentResize(e) { + if (!this.expanded) { + return; + } + const entry = e[0]; + if (entry.contentRect) { + this._height = entry.contentRect.height; + } + } + _onTransitionEnd() { if (this._state === states.EXPANDING) { this._state = states.EXPANDED; @@ -124,17 +131,5 @@ class ExpandCollapse extends LitElement { } } - _onContentResize() { - if (!this.expanded) { - return; - } - this._updateHeight(); - } - - _updateHeight() { - const content = this._getContent(); - this._height = content.scrollHeight; - } - } customElements.define('d2l-expand-collapse', ExpandCollapse); diff --git a/components/expand-collapse/test/.eslintrc.json b/components/expand-collapse/test/.eslintrc.json new file mode 100644 index 00000000000..b3d86243e15 --- /dev/null +++ b/components/expand-collapse/test/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "brightspace/open-wc-testing-config" +} diff --git a/components/expand-collapse/test/expand-collapse.visual-diff.html b/components/expand-collapse/test/expand-collapse.visual-diff.html new file mode 100644 index 00000000000..ad1231be6e7 --- /dev/null +++ b/components/expand-collapse/test/expand-collapse.visual-diff.html @@ -0,0 +1,46 @@ + + + + + + + + d2l-expand-collapse + + + + + + + +
    + +
      +
    • Coffee
    • +
    • Tea
    • +
    • Milk
    • +
    +
    +
    +
    + +
      +
    • Coffee
    • +
    • Tea
    • +
    • Milk
    • +
    +
    +
    + + + diff --git a/components/expand-collapse/test/expand-collapse.visual-diff.js b/components/expand-collapse/test/expand-collapse.visual-diff.js new file mode 100644 index 00000000000..98754b09c77 --- /dev/null +++ b/components/expand-collapse/test/expand-collapse.visual-diff.js @@ -0,0 +1,30 @@ +const puppeteer = require('puppeteer'); +const VisualDiff = require('@brightspace-ui/visual-diff'); + +describe('d2l-expand-collapse', () => { + + const visualDiff = new VisualDiff('expand-collapse', __dirname); + + let browser, page; + + before(async() => { + browser = await puppeteer.launch(); + page = await visualDiff.createPage(browser, { viewport: { width: 400, height: 400 } }); + await page.goto(`${visualDiff.getBaseUrl()}/components/expand-collapse/test/expand-collapse.visual-diff.html`, { waitUntil: ['networkidle0', 'load'] }); + await page.bringToFront(); + }); + + after(async() => await browser.close()); + + [ + 'collapsed', + 'expanded' + ].forEach((testName) => { + it(testName, async function() { + const selector = `#${testName}`; + const rect = await visualDiff.getRect(page, selector); + await visualDiff.screenshotAndCompare(page, this.test.fullTitle(), { clip: rect }); + }); + }); + +}); From 158b7f81ba0755e150a7c7868b3c0a3908d79ece Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Thu, 14 May 2020 12:20:38 -0400 Subject: [PATCH 04/12] Fix defect were transition would get skipped periodically when transitioning from display: none or from auto to 0 This was fixed by adding a double requestAnimationFrame wait. The reason for this is that when a Lit property gets updated, the browser will not immediately perform a style recalc. The next style recalc will happens after the next requestAnimationFrame. If we try to update styles again in the first requestAnimationFrame block then the first style change from the property change will be overwritten and never get displayed by the browser causing the transition to be skipped. In the second requestAnimationFrame we can guarantee that the property style change has taken effect so it is now safe to make our dependent style update. --- components/expand-collapse/expand-collapse.js | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/components/expand-collapse/expand-collapse.js b/components/expand-collapse/expand-collapse.js index 353d4aabc9b..89487b31c9e 100644 --- a/components/expand-collapse/expand-collapse.js +++ b/components/expand-collapse/expand-collapse.js @@ -1,12 +1,13 @@ import { css, html, LitElement } from 'lit-element/lit-element.js'; -import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js'; import { styleMap } from 'lit-html/directives/style-map.js'; const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches; const states = { + PRECOLLAPSING: 'precollapsing', // setting up the styles so the collapse transition will run COLLAPSING: 'collapsing', // in the process of collapsing COLLAPSED: 'collapsed', // fully collapsed + PREEXPANDING: 'preexpanding', // setting up the styles so the expand transition will run EXPANDING: 'expanding', // in the process of expanding EXPANDED: 'expanded', // fully expanded }; @@ -16,7 +17,7 @@ class ExpandCollapse extends LitElement { static get properties() { return { expanded: { type: Boolean, reflect: true }, - _height: { type: Number }, + _height: { type: String }, _state: { type: String } }; } @@ -33,7 +34,6 @@ class ExpandCollapse extends LitElement { .d2l-expand-collapse-container { display: none; - height: 0; overflow: hidden; transition: height 400ms cubic-bezier(0, 0.7, 0.5, 1); } @@ -63,17 +63,9 @@ class ExpandCollapse extends LitElement { constructor() { super(); - this._onContentResize = this._onContentResize.bind(this); this.expanded = false; this._state = states.COLLAPSED; - } - - firstUpdated() { - super.firstUpdated(); - - const content = this._getContent(); - this._resizeObserver = new ResizeObserver(this._onContentResize); - this._resizeObserver.observe(content); + this._height = '0'; } updated(changedProperties) { @@ -83,9 +75,7 @@ class ExpandCollapse extends LitElement { } render() { - const styles = { - height: this.expanded ? `${this._height}px` : null - }; + const styles = { height: this._height }; return html`
    @@ -97,15 +87,34 @@ class ExpandCollapse extends LitElement { async _expandedChanged(val) { if (val) { - this._state = reduceMotion ? states.EXPANDED : states.EXPANDING; - await this.updateComplete; - const content = this._getContent(); - if (content) { - this._height = content.scrollHeight; + if (reduceMotion) { + this._state = states.EXPANDED; + this._height = 'auto'; + } else { + this._state = states.PREEXPANDING; + await this.updateComplete; + await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))); + if (this._state === states.PREEXPANDING) { + this._state = states.EXPANDING; + const content = this._getContent(); + this._height = `${content.scrollHeight}px`; + } } } else { - this._state = reduceMotion ? states.COLLAPSED : states.COLLAPSING; - this._height = null; + if (reduceMotion) { + this._state = states.COLLAPSED; + this._height = '0'; + } else { + this._state = states.PRECOLLAPSING; + const content = this._getContent(); + this._height = `${content.scrollHeight}px`; + await this.updateComplete; + await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))); + if (this._state === states.PRECOLLAPSING) { + this._state = states.COLLAPSING; + this._height = '0'; + } + } } } @@ -113,19 +122,10 @@ class ExpandCollapse extends LitElement { return this.shadowRoot.querySelector('.d2l-expand-collapse-content'); } - _onContentResize(e) { - if (!this.expanded) { - return; - } - const entry = e[0]; - if (entry.contentRect) { - this._height = entry.contentRect.height; - } - } - _onTransitionEnd() { if (this._state === states.EXPANDING) { this._state = states.EXPANDED; + this._height = 'auto'; } else if (this._state === states.COLLAPSING) { this._state = states.COLLAPSED; } From c67a7cbd0c71c3cf60933f5b102b13c44ce86b3e Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Thu, 14 May 2020 12:48:57 -0400 Subject: [PATCH 05/12] Fix defect where the expand-collapse section opens with the wrong height when starting already expanded --- components/expand-collapse/expand-collapse.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/expand-collapse/expand-collapse.js b/components/expand-collapse/expand-collapse.js index 89487b31c9e..258445c2784 100644 --- a/components/expand-collapse/expand-collapse.js +++ b/components/expand-collapse/expand-collapse.js @@ -122,6 +122,15 @@ class ExpandCollapse extends LitElement { return this.shadowRoot.querySelector('.d2l-expand-collapse-content'); } + async _getUpdateComplete() { + const fontsPromise = document.fonts ? document.fonts.ready : Promise.resolve(); + await super._getUpdateComplete(); + /* wait for the fonts to load because browsers have a font block period + where they will render an invisible fallback font face that may result in + improper height calculations if the expand-collapse starts expanded */ + await fontsPromise; + } + _onTransitionEnd() { if (this._state === states.EXPANDING) { this._state = states.EXPANDED; From 330b986918898a68bf2dbd1bf0c8f9539a7b144f Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Thu, 14 May 2020 12:56:06 -0400 Subject: [PATCH 06/12] Add expand-collapse unit tests --- .../expand-collapse/test/expand-collapse.test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 components/expand-collapse/test/expand-collapse.test.js diff --git a/components/expand-collapse/test/expand-collapse.test.js b/components/expand-collapse/test/expand-collapse.test.js new file mode 100644 index 00000000000..48fd6d5bd44 --- /dev/null +++ b/components/expand-collapse/test/expand-collapse.test.js @@ -0,0 +1,14 @@ +import '../expand-collapse.js'; +import { runConstructor } from '../../../tools/constructor-test-helper.js'; + +describe('d2l-expand-collapse', () => { + + describe('constructor', () => { + + it('should construct', () => { + runConstructor('d2l-expand-collapse'); + }); + + }); + +}); From 57908c022353d199231e934623a24ff6b713ac16 Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Thu, 14 May 2020 13:49:37 -0400 Subject: [PATCH 07/12] Add expand-collapse README --- README.md | 1 + components/expand-collapse/README.md | 37 ++++++++++++++++++ .../screenshots/expand-collapse.gif | Bin 0 -> 6670 bytes 3 files changed, 38 insertions(+) create mode 100644 components/expand-collapse/screenshots/expand-collapse.gif diff --git a/README.md b/README.md index 561a296e98d..6a9e9706624 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ npm install @brightspace-ui/core * [Colors](components/colors/): color palette * [Dialogs](components/dialog/): generic and confirmation dialogs * [Dropdowns](components/dropdown/): dropdown openers and content containers + * [Expand Collapse](components/expand-collapse): component to create expandable and collapsible sections * [Focus Trap](components/focus-trap/): generic container that traps focus * [Icons](components/icons/): iconography SVGs and web components * [Inputs](components/inputs/): text, search, select, checkbox and radio inputs diff --git a/components/expand-collapse/README.md b/components/expand-collapse/README.md index e69de29bb2d..04ae542098b 100644 --- a/components/expand-collapse/README.md +++ b/components/expand-collapse/README.md @@ -0,0 +1,37 @@ +# Expand Collapse + +The `d2l-expand-collapse` element can be used to used to create expandable and collapsible sections. This component only provides the logic to expand and collapse the section. Controlling when and how the section expands or collapses is the responsibility of the user. + +![More-Less](./screenshots/expand-collapse.gif?raw=true) + +```html + + + + +

    My expand collapse content.

    +
    + + +``` + +**Properties:** + +- `expanded` (Boolean, default: `false`): Specifies the expanded/collapsed state of the content + +**Accessibility:** + +To make your usage of `d2l-expand-collapse` accessible, the `aria-expanded` attribute should be added to the element that controls expanding and collapsing section with `"true"` or `"false"` to indicate that the section is expanded or collapsed. + +## Future Enhancements + +Looking for an enhancement not listed here? Create a GitHub issue! diff --git a/components/expand-collapse/screenshots/expand-collapse.gif b/components/expand-collapse/screenshots/expand-collapse.gif new file mode 100644 index 0000000000000000000000000000000000000000..fe5740500257da6fc358cb6356fb233cd0f601a1 GIT binary patch literal 6670 zcmd6r2~-nlw#SP-ENT!$L{MB>5N$<7#jOpCKqQudpn|f9q-AY_Z9oK-0Ffx50R&?s zN&wNw8d=k9h9FA-5t>B=K_arqq6s7rC=IVb+j)K7IWu$Kn>S~2ZoX7~sod|LoBHbi zyVnYBX|mUCi?ko$2>|QnmBGXIICE3%VWVw^GEx9MH7hHNfj_sxZ(!lFM+*l42mr?b z01E(D0U#7Ufj^Ed%#Z*e46uCw*rfn=bO4tM;L-s5G~jXtaHSHs@(j4j2Ch~Cq-yX% z5BT8Cv6Q}Jsr}eg-mkRw3wL4bApQnhXFw8cuLAFNT}Jfu`bAk++;>Y1tL7;+&omuY&mdHYK^eWkFMOc&*2IZ=aE5 zl-FQbd{@;|A_JEu*3*G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UVY7D%adCFj^DRpKf6cuJ*LOuiR2 z-wVbJ$^vG934bFE0*yW)fmf3}-ar$;{P1EC9@_E+T?|2Q<FjzG4HrrM;6gD zrUfE+gkZ+_yH))^_!8!mSLo<>?)R$#f`9`pM81anCWTjAGk^CcWp~vLeX3Y}cZ>69 zt$oAIf!3;nfX3luvAa(0l3nGiwD(w&4a02D>h3qe4wqtq1PkKGPWN4gx+a$nBoX!H zSM_$L+W+3{Ruynw3$;&E8L)V=`Q&=f4}v9OR%5#Zg)H?acIkfi&E#x4`t2hQUewws z$3~ov_(j7~rODsk zmGrnS+Q3WJP{v16b1_j{THChC$j3gGeRA)|t^sP^F86CoDjnR9$nP8pI2*O4Se$0n z;>pdRoryv}`pq+wyNT4hifAuI3Nm}{le(-6!|t592KJ zKN&^HJpj&R{aDhMdm&1mt3;C7p{jFwN5PGb5JDw14H4LS*N*?{oJ-z$aUR%1`H`V>Hr?~swC_X4zpCiJ z%Kxh@;b2)(0_b0NH6jR*Lj3!Sha)o53za+||5YiS;gDp%hjjE`7m}X}VsV{sitGlj zBmI3HlmFE^;oq`(@N4MquuG}$F7^K@muux^|9eyiU>EuT{c8giG4W5i_-l*wKdYL1 zvCtxAx;H*JT2?&Kv)CdnEBW*mZjr79%UOZ}xJByPT>ksiF#FqGp!hYF25=shf6oK` zKRXXbx{H4y{QO!#z4dVDi0`5M{JTOw?ulBA;#&fB;3(w2M{(l+A&Px}-A}9G1>ybl a?auwb?Wbj5Gr7>zgZI-nm;d~J+W%kj`4J5O literal 0 HcmV?d00001 From 0c769a02c339b916f84f0141a0d1555bf8ef47e5 Mon Sep 17 00:00:00 2001 From: BrightspaceGitHubReader Date: Thu, 14 May 2020 18:40:50 +0000 Subject: [PATCH 08/12] Updating golden with changes made in branch akerr/expand-collapse/dev --- .../d2l-expand-collapse-collapsed.png | Bin 0 -> 392 bytes .../d2l-expand-collapse-expanded.png | Bin 0 -> 9166 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 components/expand-collapse/test/screenshots/ci/golden/expand-collapse/d2l-expand-collapse-collapsed.png create mode 100644 components/expand-collapse/test/screenshots/ci/golden/expand-collapse/d2l-expand-collapse-expanded.png diff --git a/components/expand-collapse/test/screenshots/ci/golden/expand-collapse/d2l-expand-collapse-collapsed.png b/components/expand-collapse/test/screenshots/ci/golden/expand-collapse/d2l-expand-collapse-collapsed.png new file mode 100644 index 0000000000000000000000000000000000000000..5061cc931e39cc9d82c035d42e14d117e92737b8 GIT binary patch literal 392 zcmeAS@N?(olHy`uVBq!ia0y~yVA=p=TX3)eNmh%~T0n}iILO_JVcj{Imq50Yr;B4q z#hkY{47r#cc~}nKPX7Nt)v_cY_w9k@?QRB!DQDlj`$@hrsE#^y pS8mSDI2MKmeR=A;7;e=R{-mQEdA`^Adw~JO;OXk;vd$@?2>^=6S!n_-~Xhf6xt*Tl_e4GWR$TdG-O{!_Kd!Oey$2r$w%ys>i@AtF)uIC1NS{&?r><|cq z1AhCK5d^|g4uR}bJaiEJ<;Ks)&%kA$uaVYG2(J6wGz4-U0>7nZ5|l<82@EkY-TAWU zESe>pvu|Hcf$;G{__1S#w=|9&IJK`OS4zWb5Zf^$S1575uOvDuy@;jHTGfu*iuKm{ zx5rfX!6Ai*g@x}OdM&fed_u*<#(ohV6UMIDu5~M|{h*fzH>@sp)=Yi>;YF|nBM84R zmun5K5Q8%Z%)#YM1mp;~WFNEJ2Z7j~Vz~l-d2utG75t~+AuxW(AME>1gNx>cW)=vf zS?uqBDF{`op4!!~w0Ap4FM>1E;lRK20L4a5k1)js&NE8HrHD*1pVT;&8a=o;Wkh;otrLoHHQgpYdNE?}Kd7V_8AHzS7ptdLI6d)mx(ZdJ6`-on< zW^5aVw{a)o`XAY%yDB_y-wqu?Q$mpimI%`#lfpm6JJb882kPjdnPqYwu^rU*0NOyI zaqz+K{3<&+*C`oU)z#JK1}&U`J3E-*y@nSq*_26C0wbW4&b^-x1V zoi!MPp`Bf3>nv!bmS~8jUWg3((WJC_^7u0Q&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4`}+EX;Ul$vy|HRd($sc9#}CgpCuZuXxZCO< z&MXkNZ4YJ zyu7@Iv|gIy%P-)_=zRoOr@Mn@4T*BOS!>x1r%s&`1IcQ-MZI5PqgB(-T4iwP0M5)7 zBpq~yzg>8;(rxMO_OTjmabdN&tjX<59X-M4K7gnjU=M{aDk}EKzun$kHM|wHZd#Tk zDkvz(F-M`mY->Ggpvb#TJ6$sm(9AyZQiHu5;lmTDGR(r>IR&yS#i-;E1aj*C${gcM zO*sory42ZO30qs+i0ke}g|BVuK6DisA;oOn+I5#?qehm*lBY*0NZ(Cy=2YUyn8XF{UwFK~B*EXKtr+%}sl^ zs6%6*%?dzuB*evK!Hx5#OVJG;kw_}JJ?xN-hvA))Me2|&>qs^J=P=-|~Ji^>O$ z%5Sb~F=mL8G@qyvv(gkk#?~@vC9(m9CIQw@@G%9CIeDo3>xVLJZV((K1n>@C0hu>& zR`0qIIE%g0F{zd)P?wjE*%{_Bf^tw*BVYDT6gdT6T;BVj8Go_)Z6|XXn_*a-DCt-+ z6c6~|`RjZ!dHLMR4$#jUj=rcMv~j8=_Tc!k*Qh|?wkLrdpmxTP=)}o|FH`9h#Z)=o zM*va6@BMpTHTdrc9&mNI#E|HB?K%MU5UbWRe+}TDe%B!toQ9$*KZPVdWX$!08yF00 z!*;K-{DdY(m{^gfAO31Wn0nk9<9slAM{1@r< d_h-F Date: Fri, 15 May 2020 12:10:25 -0400 Subject: [PATCH 09/12] Update expand-collapse so that it doesn't have a transition on its initial state change so it can start expanded or collapsed --- components/expand-collapse/expand-collapse.js | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/components/expand-collapse/expand-collapse.js b/components/expand-collapse/expand-collapse.js index 258445c2784..aa28a280ad1 100644 --- a/components/expand-collapse/expand-collapse.js +++ b/components/expand-collapse/expand-collapse.js @@ -64,13 +64,16 @@ class ExpandCollapse extends LitElement { constructor() { super(); this.expanded = false; - this._state = states.COLLAPSED; this._height = '0'; + this._isFirstUpdate = true; + this._state = states.COLLAPSED; } updated(changedProperties) { + super.updated(changedProperties); if (changedProperties.has('expanded')) { - this._expandedChanged(this.expanded); + this._expandedChanged(this.expanded, this._isFirstUpdate); + this._isFirstUpdate = false; } } @@ -85,9 +88,9 @@ class ExpandCollapse extends LitElement { `; } - async _expandedChanged(val) { + async _expandedChanged(val, firstUpdate) { if (val) { - if (reduceMotion) { + if (reduceMotion || firstUpdate) { this._state = states.EXPANDED; this._height = 'auto'; } else { @@ -101,7 +104,7 @@ class ExpandCollapse extends LitElement { } } } else { - if (reduceMotion) { + if (reduceMotion || firstUpdate) { this._state = states.COLLAPSED; this._height = '0'; } else { @@ -122,15 +125,6 @@ class ExpandCollapse extends LitElement { return this.shadowRoot.querySelector('.d2l-expand-collapse-content'); } - async _getUpdateComplete() { - const fontsPromise = document.fonts ? document.fonts.ready : Promise.resolve(); - await super._getUpdateComplete(); - /* wait for the fonts to load because browsers have a font block period - where they will render an invisible fallback font face that may result in - improper height calculations if the expand-collapse starts expanded */ - await fontsPromise; - } - _onTransitionEnd() { if (this._state === states.EXPANDING) { this._state = states.EXPANDED; From 9a1bb3612d69870f692c24786743304b1db263c0 Mon Sep 17 00:00:00 2001 From: Allan Kerr Date: Fri, 15 May 2020 12:27:00 -0400 Subject: [PATCH 10/12] Respond to PR feedback: Add quotes around attribute Remove separate _getContent helper and inline it Add link to w3 aria-expanded in README --- components/expand-collapse/README.md | 6 +++--- components/expand-collapse/expand-collapse.js | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/components/expand-collapse/README.md b/components/expand-collapse/README.md index 04ae542098b..e9b79f6b96b 100644 --- a/components/expand-collapse/README.md +++ b/components/expand-collapse/README.md @@ -1,8 +1,8 @@ # Expand Collapse -The `d2l-expand-collapse` element can be used to used to create expandable and collapsible sections. This component only provides the logic to expand and collapse the section. Controlling when and how the section expands or collapses is the responsibility of the user. +The `d2l-expand-collapse` element can be used to used to create expandable and collapsible content. This component only provides the logic to expand and collapse the content; controlling when and how it expands or collapses is the responsibility of the user. -![More-Less](./screenshots/expand-collapse.gif?raw=true) +![Expand Collapse](./screenshots/expand-collapse.gif?raw=true) ```html - - +

    My expand collapse content.

    -
    - - + ``` **Properties:** @@ -30,7 +22,7 @@ The `d2l-expand-collapse` element can be used to used to create expandable and c **Accessibility:** -To make your usage of `d2l-expand-collapse` accessible, the [`aria-expanded` attribute](https://www.w3.org/TR/wai-aria/#aria-expanded) should be added to the element that controls expanding and collapsing the content with `"true"` or `"false"` to indicate that the content is expanded or collapsed. +To make your usage of `d2l-expand-collapse-content` accessible, the [`aria-expanded` attribute](https://www.w3.org/TR/wai-aria/#aria-expanded) should be added to the element that controls expanding and collapsing the content with `"true"` or `"false"` to indicate that the content is expanded or collapsed. ## Future Enhancements diff --git a/components/expand-collapse/demo/expand-collapse.html b/components/expand-collapse/demo/expand-collapse-content.html similarity index 90% rename from components/expand-collapse/demo/expand-collapse.html rename to components/expand-collapse/demo/expand-collapse-content.html index 32f3b20b2c7..05a98d38eda 100644 --- a/components/expand-collapse/demo/expand-collapse.html +++ b/components/expand-collapse/demo/expand-collapse-content.html @@ -10,19 +10,19 @@ - +

    Default