@@ -69,6 +69,7 @@ export const AppLayoutMixin = (superclass) =>
6969 readOnly : true ,
7070 value : false ,
7171 reflectToAttribute : true ,
72+ observer : '__overlayChanged' ,
7273 sync : true ,
7374 } ,
7475
@@ -247,6 +248,22 @@ export const AppLayoutMixin = (superclass) =>
247248 this . __setAriaExpanded ( ) ;
248249 }
249250
251+ /**
252+ * A callback for the `overlay` property observer.
253+ *
254+ * When layout resizes while in the overlay mode, drawer opened state
255+ * is not changed, but focus trap needs to be removed.
256+ *
257+ * @param {boolean } overlay
258+ * @param {boolean } oldOverlay
259+ * @private
260+ */
261+ __overlayChanged ( _overlay , oldOverlay ) {
262+ if ( oldOverlay ) {
263+ this . __restoreFocus ( ) ;
264+ }
265+ }
266+
250267 /**
251268 * A callback for the `i18n` property observer.
252269 *
@@ -409,9 +426,7 @@ export const AppLayoutMixin = (superclass) =>
409426 return ;
410427 }
411428
412- this . __ariaModalController . close ( ) ;
413- this . __focusTrapController . releaseFocus ( ) ;
414- this . $ . drawer . removeAttribute ( 'tabindex' ) ;
429+ this . __restoreFocus ( ) ;
415430
416431 // Move focus to the drawer toggle when closing the drawer.
417432 const toggle = this . querySelector ( 'vaadin-drawer-toggle' ) ;
@@ -421,6 +436,13 @@ export const AppLayoutMixin = (superclass) =>
421436 }
422437 }
423438
439+ /** @private */
440+ __restoreFocus ( ) {
441+ this . __ariaModalController . close ( ) ;
442+ this . __focusTrapController . releaseFocus ( ) ;
443+ this . $ . drawer . removeAttribute ( 'tabindex' ) ;
444+ }
445+
424446 /**
425447 * Closes the drawer on Escape press if it has been opened in the overlay mode.
426448 *
0 commit comments