Skip to content

fix: let Escape leave fullscreen only when nothing is open above the … - #87

Open
JVariance wants to merge 2 commits into
awcodes:3.xfrom
JVariance:split/fullscreen-escape
Open

JVariance wants to merge 2 commits into
awcodes:3.xfrom
JVariance:split/fullscreen-escape

Conversation

@JVariance

Copy link
Copy Markdown

…editor

Escape left fullscreen on every key press, so closing a brick's form, the brick picker or the outline sheet with Escape also left fullscreen. In a field inside a modal, all fullscreen editors on the page closed at once. Escape now first closes what lies above the editor and only then leaves fullscreen, without closing a modal the field sits in.

…editor

Escape left fullscreen on every key press, so closing a brick's form,
the brick picker or the outline sheet with Escape also left fullscreen.
In a field inside a modal, all fullscreen editors on the page closed at
once. Escape now first closes what lies above the editor and only then
leaves fullscreen, without closing a modal the field sits in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@awcodes awcodes left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, and good call matching Filament's own "topmost modal" check.

One thing before I merge. The description says Escape now closes what's above the editor "without closing a modal the field sits in". That's true for the fullscreen step, but not for the brick picker or the outline sheet. With the field inside a Filament modal, pressing Escape with either of those open closes the overlay and the host modal. Neither overlay is a .fi-modal and neither stops propagation, so the host modal still treats itself as topmost. It happens with or without fullscreen.

It's the same class of bug this PR fixes, so I'd rather fix it here than ship half of it. Could the picker and outline sheet handle their own Escape and stop it there?

…ing a modal the field sits in

The picker and the outline sheet closed on Escape through their own window
listeners, which let the event reach a Filament modal around the field, so
that modal closed too. One capture listener on the field now closes the
picker, the outline sheet or fullscreen, one at a time, and stops the event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JVariance

Copy link
Copy Markdown
Author

Fixed in b03a024. The picker and the outline sheet no longer have their own Escape listeners. One capture listener on the field (handleEscape(), replacing exitFullscreenOnEscape()) closes the picker, then the outline sheet, then fullscreen, one per key press, and stops the event there, so a modal around the field stays open. A Filament modal above the editor, such as a brick's form, still closes itself first.

@JVariance
JVariance requested a review from awcodes October 31, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants