Skip to content

fix(naked_ui): report a button press on pointer down without a long-press handler - #683

Open
chrishiguto wants to merge 6 commits into
fortal-refresh/wb-fix-4-widgetbookfrom
fortal-refresh/wb-fix-5-button-press
Open

chrishiguto wants to merge 6 commits into
fortal-refresh/wb-fix-4-widgetbookfrom
fortal-refresh/wb-fix-5-button-press

Conversation

@chrishiguto

@chrishiguto chrishiguto commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Why

Every NakedButton registered long-press callbacks, with or without an onLongPress. With a long-press recognizer in the gesture arena, the tap recognizer waits kPressTimeout (100ms) before it reports the press, so every Remix and Fortal button showed its pressed look about 120ms after pointer down.

Scope

  • NakedButton registers its long-press callbacks only when it is interactive and has an onLongPress.
  • Tests: without a long-press handler the press is reported on pointer down; with one, the long press still fires and keeps the press until release.

Blast Radius

Every naked_ui consumer of NakedButton (Remix buttons, icon buttons, number field steppers, select, multi select, menu and popover triggers) changes in three ways when the button has no onLongPress. All three match Flutter's InkWell, checked by a test that runs the same gestures on both:

  • The press (pressed, onPressChange(true)) is reported on pointer down instead of 100ms later, when no other recognizer competes.
  • A long hold activates onPressed on release. Before, the long-press recognizer won the arena and the hold did nothing.
  • Dragging off the button shows the press, then cancels it without activating. Before, the press never showed inside the 100ms window.

With an onLongPress nothing changes: the tap still waits kPressTimeout for the arena, as InkWell's does.

  • CHANGELOG.md (naked_ui, Unreleased) says the same.
  • naked_ui_docs/references.json re-pins the button reference to the changed source; the documented signature is unchanged.
  • The widgetbook's button story now starts with its "Enable Long Press" knob off. With it on, the story's own long-press recognizer held every tap for 100ms, which is why the widgetbook showed no change while a standalone app did.

Verification

  • Gesture arena in the widgetbook button story (debugPrintGestureArenaDiagnostics): with the knob on, the arena holds the button's own TapGestureRecognizer and LongPressGestureRecognizer and nothing else from the widgetbook shell; with it off, the tap is the only member and wins at once.

  • Press to first painted frame in the release widgetbook, semantics off: 122 and 128ms before (knob on), 19 to 28ms now.

  • Matches InkWell tests: a long hold without onLongPress (1 tap, pressed true then false), a long hold with it (the long press, no tap), and dragging off (no tap, pressed true then false) give the same results on InkWell and NakedButton. The old code fails the first and third.

  • Mutation: registering the long-press callbacks again makes the pointer-down test fail.

  • cd packages/naked_ui && flutter test: 1660 passed; cd packages/remix && flutter test passes.

@chrishiguto
chrishiguto force-pushed the fortal-refresh/wb-fix-5-button-press branch from 97a1112 to 20b7c05 Compare December 2, 2026 19:34

This branch has not been deployed

No deployments
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