Skip to content

fix: consume confirmation dialog key events - #9001

Open
kaluli123123 wants to merge 3 commits into
AppFlowy-IO:mainfrom
kaluli123123:fix/7342-confirm-dialog-enter-beep
Open

fix: consume confirmation dialog key events#9001
kaluli123123 wants to merge 3 commits into
AppFlowy-IO:mainfrom
kaluli123123:fix/7342-confirm-dialog-enter-beep

Conversation

@kaluli123123

@kaluli123123 kaluli123123 commented Sep 8, 2026

Copy link
Copy Markdown

Summary

  • consume the full Enter key sequence in the confirmation dialog to prevent the macOS unhandled-key alert sound
  • keep confirmation on key up and consume repeats without triggering duplicate actions
  • preserve Escape-to-dismiss behavior
  • cover handled Enter key down/up events and single confirmation

Closes #7342

Validation

  • flutter test --no-pub test/widget_test/confirm_dialog_test.dart — 1 test passed
  • flutter analyze --no-pub . — no issues found
  • Dart formatting and git diff --check pass

Validated with Flutter 3.27.4 on macOS arm64. The system alert sound itself was not exercised in a packaged app.

@sourcery-ai

sourcery-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Updates the confirmation dialog’s keyboard event handling to use Focus and explicitly consume Escape and Enter events, preventing unhandled-key system alert sounds while preserving existing actions and close semantics.

Sequence diagram for confirmation dialog key handling

sequenceDiagram
    actor User
    participant Dialog as ConfirmPopup
    participant Navigator

    User->>Dialog: Escape KeyDownEvent
    Dialog->>Dialog: _handleKeyEvent(node, event)
    Dialog->>Navigator: pop()
    Dialog-->>User: KeyEventResult.handled

    User->>Dialog: Enter KeyUpEvent
    Dialog->>Dialog: _handleKeyEvent(node, event)
    Dialog->>Dialog: onConfirm(context)
    opt closeOnAction
        Dialog->>Navigator: pop()
    end
    Dialog-->>User: KeyEventResult.handled
Loading

File-Level Changes

Change Details Files
Route confirmation-dialog keyboard handling through a Focus widget that explicitly reports whether each event was handled.
  • Replace KeyboardListener with Focus and a dedicated key-event handler.
  • Preserve Escape-to-dismiss and Enter-to-confirm behavior, including conditional close behavior.
  • Return handled for consumed Escape and Enter events, and ignored for disabled or unrelated events.
frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#7342 Prevent the macOS system alert sound when pressing Enter to confirm document deletion in the confirmation dialog.
#7342 Continue handling Enter and Escape keyboard actions in the confirmation dialog while marking the relevant events as handled so they are not propagated as unhandled key events.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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.

[Bug] "Bip" sound when pressing enter to confirm deletion of document

2 participants