Skip to main content

activate_dialog_default_on_enter

Function activate_dialog_default_on_enter 

Source
pub fn activate_dialog_default_on_enter(
    keys: MessageReader<'_, '_, KeyPressed>,
    tracker: Res<'_, FocusTracker>,
    dialogs: Query<'_, '_, (Entity, Option<&Visible>, Option<&mut DialogSession>), With<DialogMarker>>,
    children: Query<'_, '_, &Children>,
    tags: Query<'_, '_, &LumenTag>,
    inputs: Query<'_, '_, &TextInput>,
    defaults: Query<'_, '_, (), With<DefaultButton>>,
    disabled: Query<'_, '_, (), With<Disabled>>,
    orders: Query<'_, '_, &DocumentOrder>,
    clicks: MessageWriter<'_, ClickEvent>,
)
Expand description

Enter anywhere in an open <dialog> activates its DEFAULT button (Qt QDialog default-button contract) - unless focus sits on a button (its own Enter->click path wins) or on a multiline text input (Enter inserts a newline). Single-line inputs DO trigger the default (Qt/web: Enter in a line edit fires the default button) alongside their own commit event.

The default button is the first enabled DefaultButton descendant; with none marked, the first enabled <button> in markup order (Qt autoDefault). The synthesized ClickEvent flows through the normal click dispatchers, so scripts observe a regular on_click. Activation through THIS path always marks the close accepted (DialogSession::pending_accept); direct pointer clicks mark it only for an explicitly default="true" button (mark_dialog_accept_on_default_click).