|
3 | 3 | * Copyright (c) 2018 - 2025 Vaadin Ltd. |
4 | 4 | * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ |
5 | 5 | */ |
6 | | -import { afterNextRender, beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js'; |
7 | 6 | import { AriaModalController } from '@vaadin/a11y-base/src/aria-modal-controller.js'; |
8 | 7 | import { FocusTrapController } from '@vaadin/a11y-base/src/focus-trap-controller.js'; |
| 8 | +import { animationFrame } from '@vaadin/component-base/src/async.js'; |
| 9 | +import { Debouncer } from '@vaadin/component-base/src/debounce.js'; |
9 | 10 | import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js'; |
10 | 11 |
|
11 | 12 | /** |
@@ -144,7 +145,9 @@ export const AppLayoutMixin = (superclass) => |
144 | 145 | window.addEventListener('resize', this.__boundResizeListener); |
145 | 146 | this.addEventListener('drawer-toggle-click', this.__drawerToggleClickListener); |
146 | 147 |
|
147 | | - beforeNextRender(this, this._afterFirstRender); |
| 148 | + requestAnimationFrame(() => { |
| 149 | + this._updateOffsetSize(); |
| 150 | + }); |
148 | 151 |
|
149 | 152 | this._updateTouchOptimizedMode(); |
150 | 153 | this._updateDrawerSize(); |
@@ -255,12 +258,6 @@ export const AppLayoutMixin = (superclass) => |
255 | 258 | this.__updateDrawerAriaAttributes(); |
256 | 259 | } |
257 | 260 |
|
258 | | - /** @protected */ |
259 | | - _afterFirstRender() { |
260 | | - this._blockAnimationUntilAfterNextRender(); |
261 | | - this._updateOffsetSize(); |
262 | | - } |
263 | | - |
264 | 261 | /** @private */ |
265 | 262 | _drawerToggleClick(e) { |
266 | 263 | e.stopPropagation(); |
@@ -508,8 +505,11 @@ export const AppLayoutMixin = (superclass) => |
508 | 505 | /** @protected */ |
509 | 506 | _blockAnimationUntilAfterNextRender() { |
510 | 507 | this.setAttribute('no-anim', ''); |
511 | | - afterNextRender(this, () => { |
512 | | - this.removeAttribute('no-anim'); |
| 508 | + |
| 509 | + this.__debounceAnimation = Debouncer.debounce(this.__debounceAnimation, animationFrame, () => { |
| 510 | + setTimeout(() => { |
| 511 | + this.removeAttribute('no-anim'); |
| 512 | + }); |
513 | 513 | }); |
514 | 514 | } |
515 | 515 |
|
|
0 commit comments