Skip to content

Dialogs: provide a simpler internal API that avoids having to use button index magic #170492

@rehmsen

Description

@rehmsen

When providing a cancelId, VSCode on Linux/Mac reverses the button order and moves the cancel button in the second right most position:

// macOS/linux: reverse button order if `cancelId` is defined

This means that when you have e.g. three buttons, Cancel will be between the other two.

I could not find more documentation on it, so I am not sure what exactly the intent is. According this website Windows prefers Cancel to be the right most button, and MacOS prefers an action button to be right most, and Cancel to the left of that. What is not completely clear from this guideline is what should happen if there are three buttons (say primary action, secondary action, cancel). I would have expected cancel to be either on the far left or far right, but not between the primary and secondary action. The first example for VSCode's webview button guidelines also seems to suggest that Cancel is not between "Publish" and "Create" but, in this case, to the left.

More generally, reordering (only) when cancelId is provided is a surprising side effect, and it should probably be documented that input order is expected to be Windows-style (Cancel last).

I would be happy to send a PR with some documentation around this, and would also love to send a change to avoid having the cancel button in the middle between multiple action buttons, but I first wanted to better understand what the intention in change 3074fd5 by @lramos15 was.

Thanks for your time!

Metadata

Metadata

Labels

dialogsIssues with native and custom dialogsinsiders-releasedPatch has been released in VS Code InsidersmacosIssues with VS Code on MAC/OS Xon-testplanuxUser experience issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions