Skip to content

fix(web): restore list focus after app and agent deletion - #44736

Merged
lyzno1 merged 2 commits into
mainfrom
codex/app-delete-dialog-focus
Oct 25, 2026
Merged

lyzno1 merged 2 commits into
mainfrom
codex/app-delete-dialog-focus

Conversation

@lyzno1

@lyzno1 lyzno1 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #44735.

Deleting an app or agent can leave keyboard focus on the document body after its card disappears. Keep the Studio delete dialog and mutation in the surviving catalog. On success, focus the next surviving card's primary link or existing primary button, then a previous card, and finally the named scroll viewport when no candidate remains. Candidates stay within the originating list section, and restoration preserves scroll position. Cancellation retains Base UI's default restoration to the originating action.

Each confirmation snapshots its adjacent controls and carries a fresh success-only fallback ref. Populate that ref synchronously before closing so restoration does not depend on mutation state rendering before an immediate close. AgentRosterList owns its viewport and accepts native aria-labelledby derived from the exported viewport props. App menu actions use the primitive's normal close behavior instead of manual close/microtask sequencing.

Keep the small shared card-focus helper beside the base UI components. Colocate Studio list navigation and its tests with Apps, keep its atoms private, and preserve workspace-scoped return URLs and pending URL-write flushing. These supporting behaviors do not introduce standalone top-level feature modules.

Validation

  • 131 focused unit tests passed across 7 files covering App cards/lists, Agent roster behavior, Studio navigation, main navigation, and Snippets.
  • 16 Chromium browser regressions passed against the real list/page owners: next/previous primary controls, preview-only buttons, subsequent Tab navigation, cancellation and reopening, delayed Starred-source removal, context-menu cancellation, scroll preservation, and deleting the final result with CSS transitions disabled.
  • Reviewed tests for observable behavior and removed redundant implementation-only assertions.
  • vp run dify-web#type-check passed.
  • vp run -w check passed with existing repository warnings and no errors.
  • Manually verified keyboard deletion in desktop Chrome for both Studio and Agents: next/previous card links, last-item viewport fallback, cancellation back to More, and visible keyboard focus. Disposable test items were removed.
  • Manually verified Studio → Snippets → Studio preserves the Studio filter after the navigation relocation.
  • Safari and assistive-technology testing were not performed; RTL was not rechecked in this revision.

Checklist

  • Associated issue describes the observed behavior and reproduction.
  • Verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • Completed the frontend static checks listed above.
  • No documentation update is required for this interaction fix.

From Codex

@github-actions github-actions Bot added web This relates to changes on the web. size:XXL This PR changes 1000+ lines, ignoring generated files. labels Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.01980% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.38%. Comparing base (303adae) to head (3482e28).

Files with missing lines Patch % Lines
...s/agent-v2/roster/components/agent-roster-list.tsx 95.12% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #44736   +/-   ##
=======================================
  Coverage   89.37%   89.38%           
=======================================
  Files        5985     5986    +1     
  Lines      375030   375051   +21     
  Branches    76057    76065    +8     
=======================================
+ Hits       335178   335221   +43     
+ Misses      33815    33793   -22     
  Partials     6037     6037           
Flag Coverage Δ
dify-ui 92.38% <ø> (ø)
web 89.40% <98.01%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lyzno1
lyzno1 marked this pull request as ready for review October 25, 2026 08:09
@lyzno1
lyzno1 added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit 5c510d0 Oct 25, 2026
56 checks passed
@lyzno1
lyzno1 deleted the codex/app-delete-dialog-focus branch October 25, 2026 08:18
@laipz8200 laipz8200 mentioned this pull request Nov 3, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting an app or agent can lose keyboard focus when its card disappears

2 participants