[GH-ISSUE #1290] [Bug] 300ms delay on buttons in titlebar #499

Closed
opened 2026-03-23 20:37:13 +00:00 by mirror · 17 comments
Owner

Originally created by @cbenhagen on GitHub (Oct 16, 2022).
Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/1290

Originally assigned to: @AdiAr11 on GitHub.

Bug Description

When clicking on the "close side bar" or "Share" button in the title bar there is a 300ms delay before the button reacts. This feels as if the app is very slow.

This is due to the underlying the onDoubleTap handler of the GestureDetector in MoveWindowDetector waiting for a potential second tap before defering the tap handling to its child.

How to Reproduce

Click on a button in the titlebar.

Expected Behavior

The button should react immediately.

Operating System

macOS

AppFlowy Version(s)

main branch on commit cbd84dfaa

Screenshots

No response

Additional Context

No response

Originally created by @cbenhagen on GitHub (Oct 16, 2022). Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/1290 Originally assigned to: @AdiAr11 on GitHub. ### Bug Description When clicking on the "close side bar" or "Share" button in the title bar there is a 300ms delay before the button reacts. This feels as if the app is very slow. This is due to the underlying the `onDoubleTap` handler of the `GestureDetector` in `MoveWindowDetector` waiting for a potential second tap before defering the tap handling to its child. ### How to Reproduce Click on a button in the titlebar. ### Expected Behavior The button should react immediately. ### Operating System macOS ### AppFlowy Version(s) main branch on commit cbd84dfaa ### Screenshots _No response_ ### Additional Context _No response_
Author
Owner

@ChiragKr04 commented on GitHub (Oct 16, 2022):

It might look slow. But it is a part of appflowy UX. Making it react instantly will make it snappy with no animation. I might be wrong but @annieappflowy can suggest.

<!-- gh-comment-id:1279976521 --> @ChiragKr04 commented on GitHub (Oct 16, 2022): It might look slow. But it is a part of appflowy UX. Making it react instantly will make it snappy with no animation. I might be wrong but @annieappflowy can suggest.
Author
Owner

@cbenhagen commented on GitHub (Oct 16, 2022):

Maybe I should have been clearer. I didn't mean to ommit the animation. This issue is about not having a 300ms delay before the animation starts.

The GestureDetector responsible for this 300ms delay is only used under macOS so it seems pretty clear that the delay is is not intentional:
github.com/AppFlowy-IO/AppFlowy@7b53b2c523/frontend/app_flowy/lib/core/frameless_window.dart (L43-L51)

<!-- gh-comment-id:1279998690 --> @cbenhagen commented on GitHub (Oct 16, 2022): Maybe I should have been clearer. I didn't mean to ommit the animation. This issue is about not having a 300ms delay before the animation starts. The `GestureDetector` responsible for this 300ms delay is only used under macOS so it seems pretty clear that the delay is is not intentional: https://github.com/AppFlowy-IO/AppFlowy/blob/7b53b2c523e43aeaedfa71956e69ee377213b88b/frontend/app_flowy/lib/core/frameless_window.dart#L43-L51
Author
Owner

@annieappflowy commented on GitHub (Oct 17, 2022):

@cbenhagen @ChiragKr04 thanks. I can reproduce on macOS. I agree that it reacts slower than it should be.

<!-- gh-comment-id:1280173480 --> @annieappflowy commented on GitHub (Oct 17, 2022): @cbenhagen @ChiragKr04 thanks. I can reproduce on macOS. I agree that it reacts slower than it should be.
Author
Owner

@annieappflowy commented on GitHub (Oct 17, 2022):

@LucasXu0 , can you evaluate if this is a good issue for Hacktoberfest?

<!-- gh-comment-id:1280173952 --> @annieappflowy commented on GitHub (Oct 17, 2022): @LucasXu0 , can you evaluate if this is a good issue for Hacktoberfest?
Author
Owner

@LucasXu0 commented on GitHub (Oct 17, 2022):

OK. The main reason for this issue is that the two gestures are in conflict. I think using Listener instead of GestureDetector is a way to fix this issue. Maybe there is a better way, but I don't find yet.

<!-- gh-comment-id:1280299703 --> @LucasXu0 commented on GitHub (Oct 17, 2022): OK. The main reason for this issue is that the two gestures are in conflict. I think using `Listener` instead of `GestureDetector` is a way to fix this issue. Maybe there is a better way, but I don't find yet.
Author
Owner

@LucasXu0 commented on GitHub (Oct 17, 2022):

class RoundedTextButton extends StatelessWidget {
  // ...
  @override
  Widget build(BuildContext context) {
    // ...
        child: SizedBox.expand(
          child: Listener(
            onPointerDown: (event) => onPressed?.call(),
            onPointerSignal: (event) {
              // do nothing, just to prevent to call the parent's actions
            },
            child: Center(
              child: Text(
                title ?? '',
                style: TextStyle(color: textColor, fontSize: fontSize),
              ),
            ),
          ),
          // TextButton(
          //   onPressed: onPressed,
          //   child: Text(
          //     title ?? '',
          //     style: TextStyle(color: textColor, fontSize: fontSize),
          //   ),
          // ),
   // ...
  }
}
<!-- gh-comment-id:1280310815 --> @LucasXu0 commented on GitHub (Oct 17, 2022): ``` class RoundedTextButton extends StatelessWidget { // ... @override Widget build(BuildContext context) { // ... child: SizedBox.expand( child: Listener( onPointerDown: (event) => onPressed?.call(), onPointerSignal: (event) { // do nothing, just to prevent to call the parent's actions }, child: Center( child: Text( title ?? '', style: TextStyle(color: textColor, fontSize: fontSize), ), ), ), // TextButton( // onPressed: onPressed, // child: Text( // title ?? '', // style: TextStyle(color: textColor, fontSize: fontSize), // ), // ), // ... } } ```
Author
Owner

@AdiAr11 commented on GitHub (Oct 19, 2022):

Hi, I've successfully built the app for mac. @LucasXu0 could you please guide me a little? Is the issue because of GestureDetector in frameless_window.dart which you shared?

<!-- gh-comment-id:1284313559 --> @AdiAr11 commented on GitHub (Oct 19, 2022): Hi, I've successfully built the app for mac. @LucasXu0 could you please guide me a little? Is the issue because of GestureDetector in frameless_window.dart which you shared?
Author
Owner

@AdiAr11 commented on GitHub (Oct 19, 2022):

class RoundedTextButton extends StatelessWidget {
// ...
@override
Widget build(BuildContext context) {
// ...
child: SizedBox.expand(
child: Listener(
onPointerDown: (event) => onPressed?.call(),
onPointerSignal: (event) {
// do nothing, just to prevent to call the parent's actions
},
child: Center(
child: Text(
title ?? '',
style: TextStyle(color: textColor, fontSize: fontSize),
),
),
),
// TextButton(
// onPressed: onPressed,
// child: Text(
// title ?? '',
// style: TextStyle(color: textColor, fontSize: fontSize),
// ),
// ),
// ...
}
}

What should I look for in this file?

<!-- gh-comment-id:1284314026 --> @AdiAr11 commented on GitHub (Oct 19, 2022): > class RoundedTextButton extends StatelessWidget { > // ... > @override > Widget build(BuildContext context) { > // ... > child: SizedBox.expand( > child: Listener( > onPointerDown: (event) => onPressed?.call(), > onPointerSignal: (event) { > // do nothing, just to prevent to call the parent's actions > }, > child: Center( > child: Text( > title ?? '', > style: TextStyle(color: textColor, fontSize: fontSize), > ), > ), > ), > // TextButton( > // onPressed: onPressed, > // child: Text( > // title ?? '', > // style: TextStyle(color: textColor, fontSize: fontSize), > // ), > // ), > // ... > } > } What should I look for in this file?
Author
Owner

@LucasXu0 commented on GitHub (Oct 20, 2022):

Hi, @AdiAr11. The file locates in frontend/app_flowy/packages/flowy_infra_ui/lib/widget/rounded_button.dart. The share button has to delay its response because of the GestureDetector in frameless_window.dart.

<!-- gh-comment-id:1284844731 --> @LucasXu0 commented on GitHub (Oct 20, 2022): Hi, @AdiAr11. The file locates in `frontend/app_flowy/packages/flowy_infra_ui/lib/widget/rounded_button.dart`. The share button has to delay its response because of the `GestureDetector` in `frameless_window.dart`.
Author
Owner

@AdiAr11 commented on GitHub (Oct 20, 2022):

Oh, Okay. I'll try to fix this. Thank you!

<!-- gh-comment-id:1285607022 --> @AdiAr11 commented on GitHub (Oct 20, 2022): Oh, Okay. I'll try to fix this. Thank you!
Author
Owner

@cbenhagen commented on GitHub (Oct 20, 2022):

You might also want to wrap your Listener in GestureDetector with an empty onDoubleTap handler so that double clicking your new button will not maximize the window.

<!-- gh-comment-id:1285616002 --> @cbenhagen commented on GitHub (Oct 20, 2022): You might also want to wrap your `Listener` in `GestureDetector` with an empty `onDoubleTap` handler so that double clicking your new button will not maximize the window.
Author
Owner

@AdiAr11 commented on GitHub (Oct 22, 2022):

@cbenhagen Sure, thank you!

<!-- gh-comment-id:1287655130 --> @AdiAr11 commented on GitHub (Oct 22, 2022): @cbenhagen Sure, thank you!
Author
Owner

@annieappflowy commented on GitHub (Oct 28, 2022):

@AdiAr11 , any progress update on this issue? Let us know if you need help. Thanks!

<!-- gh-comment-id:1294926569 --> @annieappflowy commented on GitHub (Oct 28, 2022): @AdiAr11 , any progress update on this issue? Let us know if you need help. Thanks!
Author
Owner

@AdiAr11 commented on GitHub (Oct 28, 2022):

@annieappflowy sorry, im out of town. I'll be back in 2 days.
I had some doubts though, I'll ask them when i get back.

<!-- gh-comment-id:1295115889 --> @AdiAr11 commented on GitHub (Oct 28, 2022): @annieappflowy sorry, im out of town. I'll be back in 2 days. I had some doubts though, I'll ask them when i get back.
Author
Owner

@annieappflowy commented on GitHub (Nov 9, 2022):

Any update / progress on this issue? @AdiAr11

<!-- gh-comment-id:1308159318 --> @annieappflowy commented on GitHub (Nov 9, 2022): Any update / progress on this issue? @AdiAr11
Author
Owner

@AdiAr11 commented on GitHub (Nov 12, 2022):

Yes, sorry for late reply. I tried the above approach and it was still the same. I researched and I saw that there is a delay because of a potential second tap.

<!-- gh-comment-id:1312423827 --> @AdiAr11 commented on GitHub (Nov 12, 2022): Yes, sorry for late reply. I tried the above approach and it was still the same. I researched and I saw that there is a delay because of a potential second tap.
Author
Owner

@annieappflowy commented on GitHub (Jan 2, 2023):

Thanks for the update.
@LucasXu0 can provide you with more guidance.

<!-- gh-comment-id:1368630254 --> @annieappflowy commented on GitHub (Jan 2, 2023): Thanks for the update. @LucasXu0 can provide you with more guidance.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#499
No description provided.