Skip to content

Allow TitleBar to not respond to onDoubleTap to fix visible delay on clicks#1340

Open
artdedeco wants to merge 2 commits into
bdlukaa:masterfrom
artdedeco:master
Open

Allow TitleBar to not respond to onDoubleTap to fix visible delay on clicks#1340
artdedeco wants to merge 2 commits into
bdlukaa:masterfrom
artdedeco:master

Conversation

@artdedeco

@artdedeco artdedeco commented Jul 5, 2026

Copy link
Copy Markdown

The new TitleBar control, which replaces the old NavigationAppBar, currently uses a GestureDetector to respond to pan (drag) and double tap/click events. However, GestureDetector has a known, currently unresolved, issue where it adds a 300ms delay to single tap events when you listen to onDoubleTap, thus rendering TitleBar unusable in any desktop, mouse & keyboard environment.

There are a few different avenues for fixing this on the library side, notably: 1) depend on a lower level gesture detection abstraction and choose our own algo for differentiating between single and double clicks - perhaps one better suited for mouse, given the target audience of the library; or 2) redesign the control so that gesture detection does not apply to the whole thing (which would have the added benefit of better aligning to Windows UX standards -- drag should not work when clicking on app icon or caption buttons, for example).

Given that both of those options would not only require non-trivial amount of work, but also a discussion phase, I'm proposing this change as a quick mitigation, so that at the very least it unblocks teams currently blocked by this, such as mine. The change is a one liner: from onDoubleTap: () => onDoubleTap?.call() to onDoubleTap: onDoubleTap; the idea being that if the caller provides a null func to onDoubleTap, the onDoubleTap callback from GestureDetector is never registered.

I categorized the commit as refactor(perf) following precedence on the changelog file, and given that the change does not alter the contract nor does it cause any externally visible change in behavior for the caller (beside the improved perf).

Pre-launch Checklist

  • I have updated CHANGELOG.md with my changes
  • I have run "dart format ." on the project
  • I have added/updated relevant documentation

…e caller doesn't provide a callback. Listening for `onDoubleTap` causes a 300ms delay on single taps (see flutter/flutter#110300)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the TitleBar component to pass the onDoubleTap callback directly instead of wrapping it in an anonymous function. This prevents the gesture detector from listening to double taps when no callback is provided, avoiding a 300ms delay on single taps. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

LanceHuang245 pushed a commit to LanceHuang245/fluent_ui that referenced this pull request Jul 9, 2026
* Initial plan

* fix: TitleBar height no longer shrinks when window is resized to smaller width (bdlukaa#1340)

Co-authored-by: bdlukaa <45696119+bdlukaa@users.noreply.github.com>

* fix: _TitleSubtitleOverflow intrinsic height includes hidden children

Co-authored-by: bdlukaa <45696119+bdlukaa@users.noreply.github.com>

* fix: Correctly position titlebar in compact overlay mode

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bdlukaa <45696119+bdlukaa@users.noreply.github.com>
Co-authored-by: Bruno D'Luka <brunodlukaa@gmail.com>
@artdedeco

artdedeco commented Jul 10, 2026

Copy link
Copy Markdown
Author

I just noticed #1298 was responsible for adding this (support for double click callback) - I had thought it was a more fundamental design decision to support it from the start; Instead, it seems more like it was just an oversight in that implementation. I guess that makes this fix I'm proposing acceptable even long-term.

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