File tree Expand file tree Collapse file tree 3 files changed +66
-1
lines changed Expand file tree Collapse file tree 3 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 1+ import '../../colors/colors.js' ;
2+ import '../../button/button-subtle.js' ;
3+ import { css , html , LitElement } from 'lit' ;
4+ import { HierarchicalViewMixin } from '../../hierarchical-view/hierarchical-view-mixin.js' ;
5+ import { LocalizeCoreElement } from '../../../helpers/localize-core-element.js' ;
6+
7+ class DemoView extends LocalizeCoreElement ( HierarchicalViewMixin ( LitElement ) ) {
8+
9+ static get styles ( ) {
10+ return [ super . styles ,
11+ css `
12+ :host {
13+ box-sizing: border-box;
14+ color: var(--d2l-color-ferrite);
15+ cursor: default;
16+ }
17+ .d2l-hierarchical-view-content {
18+ padding: 12px;
19+ }
20+ `
21+ ] ;
22+ }
23+
24+ render ( ) {
25+ return html `
26+ < div class ="d2l-hierarchical-view-content ">
27+ < div > Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters.</ div >
28+ < div >
29+ < d2l-button-subtle text ="${ this . localize ( 'components.pager-load-more.action' ) } "> </ d2l-button-subtle >
30+ </ div >
31+ </ div >
32+ ` ;
33+ }
34+
35+ }
36+
37+ customElements . define ( 'd2l-dropdown-menu-demo-view' , DemoView ) ;
Original file line number Diff line number Diff line change 1313 import '../../menu/menu-item-radio.js' ;
1414 import '../dropdown.js' ;
1515 import '../dropdown-menu.js' ;
16+ import './dropdown-menu-demo-view.js' ;
1617 </ script >
1718</ head >
1819
@@ -201,6 +202,24 @@ <h2>With Links</h2>
201202 </ template >
202203 </ d2l-demo-snippet >
203204
205+ < h2 > Custom View</ h2 >
206+ < d2l-demo-snippet >
207+ < template >
208+ < d2l-dropdown >
209+ < button class ="d2l-dropdown-opener "> Open it!</ button >
210+ < d2l-dropdown-menu >
211+ < d2l-menu label ="Astronomy ">
212+ < d2l-menu-item text ="Introduction "> </ d2l-menu-item >
213+ < d2l-menu-item text ="Searching for the Heavens ">
214+ < d2l-dropdown-menu-demo-view > </ d2l-dropdown-menu-demo-view >
215+ </ d2l-menu-item >
216+ < d2l-menu-item text ="The Solar System "> </ d2l-menu-item >
217+ </ d2l-menu >
218+ </ d2l-dropdown-menu >
219+ </ d2l-dropdown >
220+ </ template >
221+ </ d2l-demo-snippet >
222+
204223 </ d2l-demo-page >
205224
206225</ body >
Original file line number Diff line number Diff line change 11import { findComposedAncestor , getComposedParent , isComposedAncestor } from '../../helpers/dom.js' ;
22import { getNextFocusable , getPreviousFocusable } from '../../helpers/focus.js' ;
33import { css } from 'lit' ;
4+ import { getFlag } from '../../helpers/flags.js' ;
45import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js' ;
56
67const reduceMotion = matchMedia ( '(prefers-reduced-motion: reduce)' ) . matches ;
78const __nativeFocus = document . createElement ( 'div' ) . focus ;
89const escapeKeyCode = 27 ;
910
11+ const useResizeFix = getFlag ( 'GAUD-8969-hierarchical-view-resize' , true ) ;
12+
1013export const HierarchicalViewMixin = superclass => class extends superclass {
1114
1215 static get properties ( ) {
@@ -523,7 +526,13 @@ export const HierarchicalViewMixin = superclass => class extends superclass {
523526 }
524527
525528 if ( e . detail . isSource && this . __getParentViewFromEvent ( e ) === this ) {
526- e . detail . sourceView . __dispatchViewResize ( ) ;
529+ if ( useResizeFix ) {
530+ requestAnimationFrame ( ( ) => {
531+ e . detail . sourceView . __dispatchViewResize ( ) ;
532+ } ) ;
533+ } else {
534+ e . detail . sourceView . __dispatchViewResize ( ) ;
535+ }
527536 }
528537
529538 }
You can’t perform that action at this time.
0 commit comments