Skip to content

Keep toolbar dropdowns open during non-selection editor updates - #1161

Draft
jorgemanrubia wants to merge 2 commits into
mainfrom
fix-toolbar-dropdown-close-on-update
Draft

Keep toolbar dropdowns open during non-selection editor updates#1161
jorgemanrubia wants to merge 2 commits into
mainfrom
fix-toolbar-dropdown-close-on-update

Conversation

@jorgemanrubia

Copy link
Copy Markdown
Member

Summary

  • The toolbar registered an editor update listener that closed all open dropdowns on every editor update.
  • While an upload is in progress the editor fires updates for upload progress and placeholder mutations, which closed any open toolbar dropdown unexpectedly.
  • The fix closes dropdowns only when the selection actually changed between the previous and current editor state, preserving the legitimate "close on selection change" behavior while leaving dropdowns open for content-only (upload-driven) updates.

Tests

  • Added a Playwright test asserting a dropdown stays open across a content-only editor update (no selection change).
  • Added a Playwright test asserting a dropdown still closes when the selection changes.
  • Verified the first test fails without the source change and passes with it.

Fixes Basecamp card #9933920069: Toolbar dropdowns close, while upload is progressing

@jorgemanrubia jorgemanrubia self-assigned this Jun 23, 2026
The toolbar registered an editor update listener that closed every open
dropdown on each update. While an upload is in progress the editor fires
updates for progress and placeholder mutations, which closed any open
toolbar dropdown unexpectedly.

Close dropdowns only when the selection actually changed between the
previous and current editor state, preserving the legitimate close on
selection change while leaving dropdowns open for content-only updates.

Gating the close on selection changes meant a dropdown no longer closed
after the user picked one of its menuitems when the applied format left
the selection unchanged. Close the dropdowns when a command is activated
from a button inside a dropdown, so choosing a format item still closes
the menu regardless of whether the selection moved.
@jorgemanrubia
jorgemanrubia force-pushed the fix-toolbar-dropdown-close-on-update branch from 1b06c7c to 939019c Compare June 23, 2026 05:10
@jorgemanrubia jorgemanrubia added the fix-validated Bug fix manually validated: broken in production, fixed locally label Jun 23, 2026
@jorgemanrubia

Copy link
Copy Markdown
Member Author

Manual Validation: Validated

Validated by driving a real browser (Selenium) against the released CDN build on the try-it page and against this branch locally.

Primary (upload-progress / content-only update): Seeded text, clicked the text-style/heading dropdown trigger so the menu opened, then fired an editor update that mutated text content while leaving the selection untouched (the same kind of update upload progress / placeholder mutations produce). Observed the dropdown panel's hidden state via the DOM.

  • Production: dropdown closed on the content-only update (bug reproduces).
  • Local (this branch): dropdown stayed open across the content-only update (fixed).

Regression guard (menuitem still closes the dropdown): Opened the text-style dropdown and clicked the "Large Heading" menuitem. In both production and local the dropdown closed after activating the format command, and the heading was applied. The PR's #dispatchButtonCommand change correctly keeps this close-on-activate behavior even though the selection-change gate no longer triggers it. No "stuck open" menu.

Verdict: production reproduces (dropdown closes on a non-selection update), local fixed (stays open), and the menuitem-close regression guard passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix-validated Bug fix manually validated: broken in production, fixed locally

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant