LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 19, 2026, 4:27 AM
updatedAtNov 19, 2026, 5:54 AM
githubUrlhttps://github.com/neomjs/neo/issues/21430
authorneo-opus-vega
commentsCount0
parentIssue21367
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 19, 2026, 5:54 AM

A split button keeps two buttons and opens its menu from its trigger

neo-opus-vega
neo-opus-vega commented on Nov 19, 2026, 4:27 AM

Owned: a leaf of #21367 (Buttons group) until its lock, Sun 22 Nov 18:00 CET.

Context

Found while using the examples for #21142 (defect-note 006590d3). In examples/button/split on dev 0b78cebfc4 at 1024 × 768, two clicks on the caret:

before:  #neo-split-button-1, #neo-button-1
click 1: #neo-split-button-1, #neo-button-1, #neo-button-1, #neo-button-1
click 2: #neo-split-button-1, #neo-button-1 × 5

Each trigger click adds two buttons that share one id, a click on the main button adds three, and nothing opens. Neo.button.Menu, the class #4062 asked for, opens nothing either: its trigger handler is // todo: Show the menu.

The Problem

  1. The trigger is inlined, not referenced. Split#construct pushes triggerButton.vdom into the split's own vdom (src/button/Split.mjs:83). The trigger renders as part of the split, but as a component it never mounted, so each of its own updates (the ripple runs three) inserts it again.
  2. The trigger has no parent and no window. It gets parentId: me.vdom.id, the wrapper's id, which no component owns, and no windowId. Split#afterSetWindowId writes the new window into triggerButton.appName (:193).
  3. The trigger handler runs on the trigger. handler: me.splitButtonHandler passes a function, which button.Base#onClick calls with the trigger as this (src/button/Base.mjs:640-641), so an override such as Menu#splitButtonHandler cannot reach the split or its menu.
  4. A split's menu opens from the wrong button. button.Base#onClick toggles menu on any click (Base.mjs:643). A split button configured with menu opens it from the main button and leaves the caret dead.

The Architectural Reality

Design authority: src/button/Menu.mjs:25-27, the trigger handler of the split button that "Show[s] a menu when clicking on the SplitButton": // todo: Show the menu. And #4062, which asked for button.Menu from a screenshot of a split button with its menu open.

  • A component a parent renders by hand is a vdom reference: createVdomReference() (src/mixin/VdomLifecycle.mjs:184) with parentId: me.id and windowId: me.windowId, as form/field/trigger/Time.mjs:60-71 does for its clock.
  • A child's handler that belongs to its owner is a method name plus handlerScope: me, as board/CardEditor.mjs:263-264 does; bindCallback resolves the name through the owner's controller chain first (src/util/Function.mjs:166).
  • button.Base already owns the whole menu: lazy menu.List, alignment to the button, theme and window sync, destroy, and a click that lands before the list exists (#18893). Nothing new is needed for the list.
  • A floating menu.List closes on a press outside the menu and its align.target (src/menu/List.mjs:488-518). A list the split built would align to the main button, so a press on the caret closes it and the caret's click opens it again: the caret has to own the menu.

The Fix

  • src/button/Split.mjs
    • construct: the trigger gets parentId: me.id, windowId: me.windowId, handler: 'splitButtonHandler', handlerScope: me and the split's menu; the split's vdom takes triggerButton.createVdomReference().
    • afterSetMenu: hands the menu to the trigger; the split builds no list of its own.
    • afterSetWindowId: triggerButton.windowId = value.
    • toggleMenu: toggles the trigger's menu.
  • src/button/Base.mjs: onClick toggles the menu only when this button built its list (menuListReady), so a click on the split's main button leaves the trigger's menu alone.
  • src/button/Menu.mjs: the stub goes. The class keeps its className and menu-button ntype and behaves as a split button with menu.
  • examples/button/split/MainContainer.mjs: the example split gets a menu; the main button keeps its logging handler.
  • Tests: a component spec for the clicks and the menu, a unit spec for the trigger's window, handler scope and menu.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.button.Split trigger child Split#construct (Split.mjs:64-85) referenced, with the split as parent and the split's window none construct JSDoc AC-1
Split#afterSetWindowId Split.mjs:189-197 the trigger moves to the split's window none none AC-4
Split#splitButtonHandler Split.mjs:222-228 ("Override as needed or pass a controller based handler into triggerButtonConfig") runs with the split as this, before any controller method of the same name triggerButtonConfig.handler still replaces it; a name resolves from the split's controller chain method JSDoc AC-3
Split#theme (component.Base#theme_) Base.mjs:466-474 (a button's menu follows its theme) the trigger and its floating menu take the split's theme, at creation and on a change none afterSetTheme JSDoc AC-2
Split#menu (button.Base#menu_) Base.mjs:122-129 the trigger owns it: aligned to the caret, toggled by its click, closed by a press elsewhere, the main button included none afterSetMenu JSDoc AC-2
Split#toggleMenu Base.mjs:692-706 toggles the trigger's menu none method JSDoc AC-2
button.Base#onClick Base.mjs:637-646 toggles the menu only when this button built its list none method JSDoc AC-2, the button menu specs
Neo.button.Menu (menu-button) Menu.mjs, #4062 the split button behaviour above; the stub is removed none class JSDoc AC-2

Decision Record impact

none

Acceptance Criteria

  • AC-1: In examples/button/split, clicks on the trigger and on the main button leave the split with exactly two <button> elements with distinct ids.
  • AC-2: A split button with menu opens it from its trigger, a second trigger click closes it, and a click on the main button runs its handler without opening the menu.
  • AC-3: splitButtonHandler runs with the split button as this, so a subclass override reaches the split's methods.
  • AC-4: A split button that moves to another window takes its trigger along (windowId).
  • AC-5: examples/button/split opens a menu from its caret: frames of the released and the changed example.

Out of Scope

  • A split whose trigger is hidden (hideTriggerButton: true) keeps its menu closed; a plain button with menu covers that case.
  • Keyboard access beyond what button.Base gives a menu button.
  • The example's catalog record and cover (#21142, the Buttons renewal under #21367).
  • plugin.Base taking windowId only when its owner is constructed (defect-note 538d96a6).

Avoided Traps

  • Gating the menu in Menu only. A split-button with menu would keep opening from the main button with a dead caret, the trap this leaf removes.
  • Removing Neo.button.Menu. Its ntype is public on the 13.x line; the class stays, without its stub.
  • Re-inserting the trigger on update. A guard against the second insert treats the symptom; a reference makes the trigger a child the split renders once.
  • A copy of button.Base#onClick in the split without the menu toggle. It would miss whatever Base's click does next; Base deciding by the list it built needs no copy.

Related

Live latest-open + closed sweep: checked latest 20 open + open and closed search (split button; SplitButton trigger, splitButtonHandler, button.Menu; Out of Scope read on #4062 and #20694) at 2026-11-19T03:25:40Z; no equivalent or prior exclusion found. Backlog band: 78 open (red); folds under its owning epic #21367. A2A claim sweep: last 30 messages (03:12–03:19Z window and earlier), no claim on split or menu buttons. MC sweep: "split button trigger click adds duplicate buttons, menu does not open, Neo.button.Menu stub", 5 results, no prior decision found. Own-assignment sweep: 9 open, none overlapping.

Retrieval Hint: "split button trigger multiplies buttons duplicate ids splitButtonHandler stub"