You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MasterDetailLayoutLocator can't press Esc on the detail or click the backdrop #306
When a MasterDetailLayout shows its detail on top of the master (the overlay mode on a narrow screen), the user can close it by pressing Esc or by clicking the backdrop. Applications listen for this with addDetailEscapePressListener(...) and addBackdropClickListener(...), for example to deselect the row or to ask about unsaved changes first.
MasterDetailLayoutLocator/MasterDetailLayoutTester can't simulate either. They only have getMaster(), getDetail(), getDetailPlaceholder() and isDetailPlaceholderVisible(). Tests have to fire the events themselves:
MasterDetailLayoutLocator gets methods like pressEscapeOnDetail() and clickBackdrop(). They fire the events as coming from the client, and refuse when the detail isn't shown in a mode where the user could do that.
Thanks for the report. This is a valid gap: MasterDetailLayoutTester (and so the generated MasterDetailLayoutLocator) only exposes read accessors, and there is no way to simulate the two dismiss gestures the web component supports.
Root cause: the web component dispatches detail-escape-press when Escape is pressed in the detail area (in any mode, as long as there is a detail), and backdrop-click when the backdrop is clicked in overlay mode. The Flow component maps these to DetailEscapePressEvent and BackdropClickEvent via @DomEvent, but the tester never fires them.
pressEscapeOnDetail() and clickBackdrop() on the tester, so they also land on the generated locator. They fire the DOM events through the element listener map, so applications get the events with isFromClient() == true, the same way the browser would deliver them.
Both throw IllegalStateException when the layout isn't usable (hidden, disabled, inert behind a modal, …) or when no detail content is set, since then there is no detail area or backdrop to interact with.
One limit on "refuse unless the detail is in overlay mode": the browser decides on overlay mode from the space available (it sets the overlay attribute on the client), and that state is never sent to the server. The tester can't tell split mode from overlay mode, so clickBackdrop() only requires a detail to be set. Its Javadoc says this and points to setForceOverlay(true) for tests that want the overlay state to be explicit. A stricter alternative would refuse clickBackdrop() unless isForceOverlay() is true, but that would reject legitimate tests of the narrow-screen case where overlay mode comes from the viewport size. Happy to switch to that if maintainers prefer it.
Activity
totally-not-ai commentedon Oct 31, 2026
Thanks for the report. This is a valid gap:
MasterDetailLayoutTester(and so the generatedMasterDetailLayoutLocator) only exposes read accessors, and there is no way to simulate the two dismiss gestures the web component supports.Root cause: the web component dispatches
detail-escape-presswhen Escape is pressed in the detail area (in any mode, as long as there is a detail), andbackdrop-clickwhen the backdrop is clicked in overlay mode. The Flow component maps these toDetailEscapePressEventandBackdropClickEventvia@DomEvent, but the tester never fires them.Proposed solution (implemented in #310):
pressEscapeOnDetail()andclickBackdrop()on the tester, so they also land on the generated locator. They fire the DOM events through the element listener map, so applications get the events withisFromClient() == true, the same way the browser would deliver them.IllegalStateExceptionwhen the layout isn't usable (hidden, disabled, inert behind a modal, …) or when no detail content is set, since then there is no detail area or backdrop to interact with.One limit on "refuse unless the detail is in overlay mode": the browser decides on overlay mode from the space available (it sets the
overlayattribute on the client), and that state is never sent to the server. The tester can't tell split mode from overlay mode, soclickBackdrop()only requires a detail to be set. Its Javadoc says this and points tosetForceOverlay(true)for tests that want the overlay state to be explicit. A stricter alternative would refuseclickBackdrop()unlessisForceOverlay()is true, but that would reject legitimate tests of the narrow-screen case where overlay mode comes from the viewport size. Happy to switch to that if maintainers prefer it.