Skip to content

Commit 4603bad

Browse files
committed
Guard drawer re-entry when open flips false before enter microtask
A fast toggle could set open=false after _show() scheduled its updateComplete callback but before it ran. The callback then set _animState back to 'entering', re-opening the drawer while open was false — leaving it stuck open and scroll-locked, since Escape and backdrop dismissal both gate on this.open. Bail out of the open sequence if open is no longer true.
1 parent 5007205 commit 4603bad

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

openlibrary/components/lit/OlDrawer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ export class OlDrawer extends LitElement {
243243
}));
244244

245245
this.updateComplete.then(() => {
246+
// `open` may have flipped back to false before this microtask ran
247+
// (e.g. a fast toggle). If so, _hide() already owns the animation
248+
// state — resuming here would re-enter the drawer while open is
249+
// false, stranding it open and scroll-locked with no way to close
250+
// (Escape and backdrop dismissal both gate on this.open).
251+
if (!this.open) return;
252+
246253
const panel = this.shadowRoot.querySelector('.drawer');
247254
if (!panel) return;
248255

0 commit comments

Comments
 (0)