Skip to content

addToModalComponent does not nest overlays inside VISUAL modals #25136

Description

@vursen

Description of the bug

UI.setChildComponentModal(Component, ModalityMode) only pushes the component onto the modal component stack when the mode is ModalityMode.STRICT, while VISUAL goes through setChildModeless:

if (mode == ModalityMode.STRICT) {
    getInternals().setChildModal(childComponent);
} else {
    getInternals().setChildModeless(childComponent);
}

As a result, a VISUAL modal is never returned by UIInternals.getActiveModalComponent(), and UI.addToModalComponent doens't nest subsequent overlays inside it. Instead, they attach directly to the UI or to a STRICT modal lower in the stack.

This is problematic because VISUAL modals still trap focus and block pointer events on the client. Any overlay component added outside a VISUAL modal ends up behind its focus trap and is unreachable for the user.

Expected behavior

VISUAL modals participate in the modal component stack like STRICT modals, so that addToModalComponent nests overlays inside the currently active VISUAL modal. The difference between the two modes should only be server-side request blocking (inertness), which VISUAL does not apply.

Additional context

vaadin/web-components#12237 (review)

Versions

Vaadin / Flow version > 25.0

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status
    🔎 Investigation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions