Skip to content

Ariadne in the browser: Enter and Backspace reach text fields; a Send button for messages - #993

Merged
transfix merged 1 commit into
masterfrom
fix/ariadne-browser-keys-send
Nov 3, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/ariadne-browser-keys-send

Conversation

@transfix

@transfix transfix commented Nov 3, 2026

Copy link
Copy Markdown
Owner

In the browser, the conference's chat field took typed letters, but Enter and Backspace did nothing, so a message could never be sent.

Why

ImGuiOverlay hands ImGui the keys the viewer's interactor reports, by name.

  • VTK's own windows name keys the way X11 does: "Return", "BackSpace", "Left".
  • In a browser, VTK's interactor passes the page's KeyboardEvent.key instead: "Enter", "Backspace", "ArrowLeft". The overlay's table didn't know those names.
  • Letters still arrived, because they come through the CharEvent rather than the table.

Desktop builds aren't affected: SDL3 owns their window and input (#829), and the browser keeps VTK's canvas window for now. In headless Chrome with real key events, typing "hellox" then Backspace still read "hellox", and Enter posted nothing.

What changes

  • Both spellings. The key table now knows both names for Enter, Backspace, the arrows, PageUp/PageDown, the modifiers and space. It moves to an internal header, src/cvcGL/ImGuiKeyNames.h, so a test can check it without a window.
  • A send button. message_input gains send:, the label of a button on the field's right that sends the message as Enter does. The field narrows to leave the button room. Terminal backends keep Enter only.
  • The chat component uses send: Send.
  • Multi-line works once Enter does: Shift+Enter (or Ctrl+Enter) adds a line, up to max_lines (4), then the field scrolls.

Checked

  • In headless Chrome on the conference page, with real key events:

    • "hellox", then Backspace, then Enter posted "hello";
    • typing and clicking Send posted the message;
    • Shift+Enter made a two-line message, which Enter then sent.
  • cvcgl_imgui_key_names (new): both names for 16 keys, with no window or GL.

  • cvcgl_imgui_chat_widgets: a Send case, which checks the button:

    • sits inside the window;
    • sends the message and clears the draft;
    • gives the focus back to the field, so Enter still works;
    • ignores an empty field.

    The harness now makes each session's ImGui context current, because CreateContext leaves an earlier context current.

  • The loader test reads send:.

  • ariadne_loader_test 215/215, ariadne_runtime_test 250/250, and cvcgl_camera, cvcgl_imgui_ui_size, cvcgl_imgui_window_fit and cvcgl_ari_golden pass.

Not here

The longer-term fix is the next step after #829: SDL3 owning the browser canvas and its WebGL2 context, which gives the browser a single input path like the desktop builds.

… button for messages

In the browser the conference's chat field took typed letters but not
Enter or Backspace, so nothing could be sent. ImGuiOverlay hands ImGui
the keys the viewer's interactor reports, by name. VTK's own windows
name them as X11 does ("Return", "BackSpace", "Left"); in a browser
VTK's interactor passes the page's KeyboardEvent.key ("Enter",
"Backspace", "ArrowLeft"), which the overlay's table did not know.
Letters arrived anyway, through the CharEvent. Headless Chrome with real
key events: "hellox" then Backspace still read "hellox", and Enter
posted nothing.

The table now has both spellings (arrows, PageUp/PageDown, the
modifiers and " " too). It moves to an internal header,
src/cvcGL/ImGuiKeyNames.h, so cvcgl_imgui_key_names can check both
names for each key without a window or GL.

message_input gains `send:`, the label of a button on the field's right
that sends it as Enter does (ImGui; a terminal has Enter only). The
field narrows to leave the button room. The chat component uses
`send: Send`.

Multi-line already works once Enter does: Shift+Enter (and Ctrl+Enter)
add a line, up to max_lines (4), then it scrolls.

Tests: cvcgl_imgui_key_names (new); cvcgl_imgui_chat_widgets gains a
Send case (inside the window, sends, clears, keeps the focus, ignores an
empty field); the loader test reads `send:`.
@transfix
transfix merged commit 3ee9714 into master Nov 3, 2026
27 checks passed
@transfix
transfix deleted the fix/ariadne-browser-keys-send branch November 3, 2026 12:20
transfix added a commit that referenced this pull request Nov 3, 2026
…dne-python-engine

arigl's run_window: master's snapshot that ends at the frame a document
quits on, and the browser loop paced by the next animation frame
(arigl_wait_frame, CVC_ARIGL_YIELD=timeout), go into the after_load lambda
that ariglx's Python program runs; set_log_verbosity sits beside
lend_python.
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.

1 participant