Skip to content

fix: update dropdown trigger label on select#2515

Open
Branc0 wants to merge 2 commits intosuperdoc-dev:mainfrom
Branc0:fix-overflow-dropdown
Open

fix: update dropdown trigger label on select#2515
Branc0 wants to merge 2 commits intosuperdoc-dev:mainfrom
Branc0:fix-overflow-dropdown

Conversation

@Branc0
Copy link

@Branc0 Branc0 commented Mar 22, 2026

Summary

When a user selects an option from a toolbar dropdown, handleSelect updates selectedValue and emits the command, but does not update the reactive item.label used by ToolbarButton in the dropdown trigger. The visible label could stay on the initial value even though the selection changed.

dropdown.bug.mov

Steps to reproduce

  • Open the editor with a mobile viewport (under 768px width) and open the overflow menu.
  • Click on the font size dropdown and change the value.
  • The document font-size changes, but the select remains displaying the same value

Solution

This change sets item.label from option.label when there's a change in the selection, keeping the trigger text in sync with the selection.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8c95a75ff

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +140 to +141
if (option?.label) {
item.label.value = option.label;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid setting labels on dropdowns that are meant to stay icon-only

handleSelect now assigns item.label.value for every option that has a label. That fixes font-family/font-size, but it also changes the lineHeight dropdown, which is configured as an icon-only control with no initial label in packages/super-editor/src/components/toolbar/defaultItems.js:1019-1043; its state sync in super-toolbar.js:996-1001 only updates selectedValue, so the new label will stick even after the caret moves elsewhere. Because ToolbarButton.vue:118-120 renders any truthy label, selecting a line height will start showing text like 1.50 in the trigger and widen the control unexpectedly.

Useful? React with 👍 / 👎.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant