@@ -7,9 +7,24 @@ import { AriaModalController } from '@vaadin/a11y-base/src/aria-modal-controller
77import { FocusTrapController } from '@vaadin/a11y-base/src/focus-trap-controller.js' ;
88import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js' ;
99import { animationFrame } from '@vaadin/component-base/src/async.js' ;
10+ import { CSSPropertyObserver } from '@vaadin/component-base/src/css-property-observer.js' ;
1011import { Debouncer } from '@vaadin/component-base/src/debounce.js' ;
1112import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js' ;
1213
14+ CSS . registerProperty ( {
15+ name : '--vaadin-app-layout-touch-optimized' ,
16+ syntax : 'true | false' ,
17+ inherits : true ,
18+ initialValue : 'false' ,
19+ } ) ;
20+
21+ CSS . registerProperty ( {
22+ name : '--vaadin-app-layout-drawer-overlay' ,
23+ syntax : 'true | false' ,
24+ inherits : true ,
25+ initialValue : 'false' ,
26+ } ) ;
27+
1328/**
1429 * @typedef {import('./vaadin-app-layout.js').AppLayoutI18n } AppLayoutI18n
1530 */
@@ -180,6 +195,16 @@ export const AppLayoutMixin = (superclass) =>
180195 this . addController ( this . __focusTrapController ) ;
181196 this . __setAriaExpanded ( ) ;
182197
198+ this . __cssPropertyObserver = new CSSPropertyObserver ( this . $ . cssPropertyObserver , ( propertyName ) => {
199+ if ( propertyName === '--vaadin-app-layout-touch-optimized' ) {
200+ this . _updateTouchOptimizedMode ( ) ;
201+ }
202+ if ( propertyName === '--vaadin-app-layout-drawer-overlay' ) {
203+ this . _updateOverlayMode ( ) ;
204+ }
205+ } ) ;
206+ this . __cssPropertyObserver . observe ( '--vaadin-app-layout-touch-optimized' , '--vaadin-app-layout-drawer-overlay' ) ;
207+
183208 this . $ . drawer . addEventListener ( 'transitionstart' , ( ) => {
184209 this . __isDrawerAnimating = true ;
185210 } ) ;
@@ -328,8 +353,6 @@ export const AppLayoutMixin = (superclass) =>
328353 /** @private */
329354 _resize ( ) {
330355 this . _blockAnimationUntilAfterNextRender ( ) ;
331- this . _updateTouchOptimizedMode ( ) ;
332- this . _updateOverlayMode ( ) ;
333356 }
334357
335358 /** @protected */
0 commit comments