Skip to content

[combobox] Support drag-to-select - #3167

Merged
atomiks merged 11 commits into
mui:masterfrom
atomiks:feat/combobox-drag-select
Nov 13, 2025
Merged

atomiks merged 11 commits into
mui:masterfrom
atomiks:feat/combobox-drag-select

Conversation

@atomiks

@atomiks atomiks commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Closes #3086

@atomiks atomiks added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. component: combobox Changes related to the combobox component. labels Nov 7, 2025
@pkg-pr-new

pkg-pr-new Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

vite-css-base-ui-example

pnpm add https://pkg.pr.new/mui/base-ui/@base-ui-components/react@3167
pnpm add https://pkg.pr.new/mui/base-ui/@base-ui-components/utils@3167

commit: 584f7f0

@mui-bot

mui-bot commented Nov 7, 2025 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui-components/react 🔺+585B(+0.15%) 🔺+247B(+0.20%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Nov 7, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 584f7f0
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69153e66dfb9fe0008c76ee6
😎 Deploy Preview https://deploy-preview-3167--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks
atomiks force-pushed the feat/combobox-drag-select branch from 3daed83 to c7dc6f6 Compare November 7, 2025 11:41
@atomiks
atomiks marked this pull request as ready for review November 7, 2025 11:50
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 10, 2025
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 10, 2025
event.button !== 0 ||
pointerStartedOnItem ||
!highlighted ||
!store.state.inputInsidePopup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just wondering could this also work for input-outside-popup? If the pointer starts at the smaller trigger, not the input

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Possibly, though it feels a bit inconsistent for it to work only on the trigger with that layout/pattern

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with the proposal.
Seems strange to support this only on the popup mode, whereas regular Combobox closely resembles Select, but does not allow this behavior.

If we keep this behavior as is, then maybe the trigger drag -> move away behavior should change in regular behavior?
It seems slightly strange now. 🤷

Screen.Recording.2025-11-11.at.16.49.34.mov

@atomiks atomiks Nov 12, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Dragging on the input selects the text (if you had some in the input in that recording) though, so there's a functional difference there. Pretty sure no one is going to notice any of this though.

I removed the mouseup drag out behavior to match the input

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK I don't think it's hugely important now, but would be nice to have later ~

RA let's you single-pointer the trigger in this layout: https://react-spectrum.adobe.com/react-aria/ComboBox.html#example

Also maybe because it's styled it more distinctly from the input, seems like this interaction would be more discoverable

@atomiks atomiks Nov 13, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm fair enough, the styled trigger does make it more clear there. I think we can unconditionally allow drags on both the trigger and input (even if it selects text) for consistency across both, but leave the cancel-open exclusive to the input-inside-popup layout

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 11, 2025
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 11, 2025

@LukasTy LukasTy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, especially after the tiny fix. 👌

@atomiks
atomiks force-pushed the feat/combobox-drag-select branch from b377262 to 45047c6 Compare November 13, 2025 01:45
@atomiks
atomiks merged commit 268b26c into mui:master Nov 13, 2025
@atomiks
atomiks deleted the feat/combobox-drag-select branch November 13, 2025 02:20
@LukasTy

LukasTy commented Nov 13, 2025

Copy link
Copy Markdown
Member

Is it expected that releasing the mouse outside of the Popup closes the Popup in case of https://deploy-preview-3167--base-ui.netlify.app/react/components/combobox#input-inside-popup, but doesn't when used with an input? 🤔

@atomiks

atomiks commented Nov 13, 2025

Copy link
Copy Markdown
Contributor Author

@LukasTy yeah so it's consistent with the input: #3167 (comment)

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

Labels

component: combobox Changes related to the combobox component. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[combobox] Combobox with trigger does not support click and drag to select

4 participants