fix: handle new card creation from board footer - #8928
Open
tollenceld wants to merge 3 commits into
Open
tollenceld wants to merge 3 commits into
tollenceld wants to merge 3 commits into
Conversation
Clear the card draft when creation is cancelled (Escape or focus loss) so reopening '+ New' starts with an empty input, and ignore empty titles on submit so a blank Enter cannot create an 'Untitled' card. Fixes AppFlowy-IO#8922
Contributor
Reviewer's GuideUpdates the board column footer’s new-card creation flow to cancel and clear drafts on blur/Escape, prevent empty-title submissions, and adds integration tests to lock in the corrected behaviors. Sequence diagram for updated board footer card creation interactionssequenceDiagram
actor User
participant BoardColumnFooter as _BoardColumnFooterState
participant FocusNode as _focusNode
participant BoardBloc
User->>BoardColumnFooter: tap_plus_New()
BoardColumnFooter->>BoardColumnFooter: setState(_isCreating = true)
User->>BoardColumnFooter: type_title_in_textField()
alt blur or Escape
User->>FocusNode: unfocus()
FocusNode-->>BoardColumnFooter: hasFocus == false (listener)
BoardColumnFooter->>BoardColumnFooter: _cancelCreating()
BoardColumnFooter->>BoardColumnFooter: _textController.clear()
BoardColumnFooter->>BoardColumnFooter: setState(_isCreating = false)
end
alt submit non_empty_title
User->>BoardColumnFooter: onSubmitted(name)
BoardColumnFooter->>BoardColumnFooter: [name.trim().isNotEmpty]
BoardColumnFooter->>BoardBloc: BoardEvent.createRow(columnId, name)
BoardColumnFooter->>BoardColumnFooter: _textController.clear()
else submit empty_or_whitespace_title
User->>BoardColumnFooter: onSubmitted(name)
BoardColumnFooter->>BoardColumnFooter: [name.trim().isEmpty]
BoardColumnFooter-->>User: no_op (no card created)
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Escape now relies on the shared focus-loss cancellation path instead of cancelling twice in a row, and the PR description is corrected to match the actual behavior. The contributor manually verified the current fix on a real device and did not observe any issues. This does not replace pending cross-platform CI.
tollenceld
marked this pull request as ready for review
August 6, 2026 15:19
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new tests rely on
find.byType(BoardColumnFooter).at(1)for the footer, which is brittle if column ordering or counts change; consider using a more robust finder (e.g., by key or text) to target the intended footer. - There is a lot of repeated setup across the new footer tests (initialize app, sign in, create board page, tap footer); extracting a shared helper or
setUproutine would make the tests easier to maintain and adjust in the future.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new tests rely on `find.byType(BoardColumnFooter).at(1)` for the footer, which is brittle if column ordering or counts change; consider using a more robust finder (e.g., by key or text) to target the intended footer.
- There is a lot of repeated setup across the new footer tests (initialize app, sign in, create board page, tap footer); extracting a shared helper or `setUp` routine would make the tests easier to maintain and adjust in the future.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Replace the index-based footer lookup with a finder that targets the column by its group name, and extract shared board/footer test setup helpers. No product behavior was changed. The contributor manually verified the current fix on a real device and did not observe any issues. This does not replace pending cross-platform CI.
Author
|
Addressed the Sourcery feedback by replacing the index-based footer lookup with a stable finder and extracting shared board/footer test setup helpers. No product behavior was changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8922
Problem
On desktop, in a board's column footer, clicking
+ New, typing a title, and then clicking outside the input closed the input without creating a card but kept the typed draft. Reopening+ Newshowed the stale draft, and pressing Enter could then create a card with an empty title (reported as "Untitled"). Escape also left the old draft in place for the next attempt.Root cause
In
_BoardColumnFooterState(frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart):_isCreating = false; theTextEditingControllerwas never cleared, so the draft survived._focusNode.unfocus(), which went through the same blur path and left the draft intact.onSubmittedhad no empty-title guard, so pressing Enter with an empty title dispatchedBoardEvent.createRowwith an empty name, producing a card with an empty title. Because the input stayed focused after submit and the controller was cleared immediately after dispatch, a second Enter submitted the now-empty title.Behavior
Consistent with the board's other trailing create input (
_BoardTrailingState, "Add a new group", which cancels and clears on Escape and on blur), the footer now follows:+ Newalways starts with a clean, empty input.Changes
_BoardColumnFooterState:_cancelCreating(), which clears the controller and exits the creating state._cancelCreating(), so blur and Escape share one cancellation path (Escape just unfocuses, and the listener performs the single cancellation).onSubmittedignores empty/whitespace-only titles.Tests
Extended
frontend/appflowy_flutter/integration_test/desktop/board/board_add_row_test.dartwith five footer scenarios: empty-title submit, click-outside cancel + draft clear, Escape cancel + draft clear, double Enter, and submit-then-click-outside.Local results:
flutter analyze(full project): No issues found.dart format --output=none --set-exit-if-changedon changed files: clean.board_add_row_test.dart, macOS local): 4 of 7 passed (from header,from footer,empty title submit,clicking outside). Theescapetest could not complete:sendKeyEvent(escape)hangs in the macOS live binding (key-event channel round trip). The samesendKeyEvent(escape)pattern is already used by existing board tests (board_row_test.dart,board_hide_groups_test.dart) on the repo's Linux CI, so this appears to be a local macOS tooling quirk rather than a product regression. The remaining two tests were not run locally.Not run locally / pending: full integration-test pass on Linux (repo CI runs board tests via
integration_test/desktop_runner_3.dart) and Windows behavior.Manual verification
The contributor manually verified the current fix on a real device and did not observe any issues. The specific device and platform are not claimed here, and this does not replace automated cross-platform CI coverage.
CI and limitations
Ninja i18ncheck passes.license/clais pending (the contributor must sign the CLA via the CLA assistant link; this cannot be done from the CLI).action_requiredon the workflow means "awaiting maintainer approval", not a test failure.Draft status
Still a draft. Waiting on:
Summary by Sourcery
Ensure board column footer new-card input cancels cleanly and does not create unintended cards when blurred, escaped, or submitted with empty text.
Bug Fixes:
Tests: