Skip to content

egui: press targets, per-widget enable, focus filter, Escape drag abort - #41

Open
aiongg wants to merge 5 commits into
storytold:craft/0.37-pinfrom
aiongg:next-focus-pointer
Open

aiongg wants to merge 5 commits into
storytold:craft/0.37-pinfrom
aiongg:next-focus-pointer

Conversation

@aiongg

@aiongg aiongg commented Nov 14, 2026

Copy link
Copy Markdown
  • InteractOptions::enabled: disables one widget of an enabled Ui.
  • Memory::request_focus_with_filter: requests focus with an event filter applied from the next pass.
  • InteractOptions::activate_on_space.
  • Each pointer press goes to the widget under the press position.
  • DragAndDrop::aborted_by_escape: true in the pass where Escape cleared the payload.

Behaviour changes

A pointer press goes to the widget under the press position (PointerEvent::Pressed::position), not the one under the pass's last pointer position. When a press and moves arrive in one pass (a quick drag, a slow frame), is_pointer_button_down_on, drag_started and clicked name the widget under the press. Hover stays at the last position.

Tests

  • test_interact_opt_disabled_widget_in_enabled_ui
  • test_interact_opt_activate_on_space
  • test_press_goes_to_widget_under_press
  • escape_abort_is_reported_for_one_pass
  • request_focus_with_filter_applies_the_filter_from_the_next_pass

PATCHES.md: E26, E27 (the first three items have no row).

These commits are on next, which craft-libs next pins.

`Ui::interact_opt` registers the widget as enabled only if both the `Ui`
and `InteractOptions::enabled` are. A widget can then draw its own
disabled look without a disabled child `Ui`, which would fade its
painter, add a node to the accessibility tree and shift the auto-ids of
the widgets after it.
Requests focus together with the event filter the widget keeps while
focused. `set_focus_lock_filter` only applies once the widget had focus
for a pass, so a widget that moves focus to a sibling on an arrow key
(a radio group) lost it to egui's directional focus when a second arrow
key came in the pass right after the request.
Enter and Space both act as a click on a focused widget. With
`activate_on_space: false`, only Enter does, as for a link: Space
doesn't activate a link, it scrolls the page in a browser. Defaults to
true, which keeps the current behaviour.
@aiongg
aiongg force-pushed the next-focus-pointer branch from 3693e76 to 5058c9f Compare November 14, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant