Skip to content

Replace PositronButton with Button#12795

Merged
dhruvisompura merged 13 commits into
mainfrom
ui-buttons
Apr 15, 2026
Merged

Replace PositronButton with Button#12795
dhruvisompura merged 13 commits into
mainfrom
ui-buttons

Conversation

@bricestacey

@bricestacey bricestacey commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

This PR migrates all use cases of PositronButton to our preferred Button component.

PositronButton rendered an unstyled <div> with role="button". The newer Button component renders a proper <button> element with built-in hover management, focus handling, and accessibility. This migration improves semantic HTML and keyboard accessibility across all affected areas.

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

@:connections @:console @:positron-notebooks @:plots

Console:

  • Trigger a Python error (raise Exception("test")) and verify the Show/Hide Traceback toggle works (click + keyboard)
  • With Posit Assistant enabled, verify the Fix and Explain buttons appear and work on errors
  • Click the info button in the console action bar. Verify the output channel links in the popup are rendered in block order.

Connections:

  • Create a SQLite or DuckDB connection via the New Connection dialog
  • Browse the schema tree; verify the preview icon on table rows works (Python connections only)
  • Disconnect, then reconnect -- verify all buttons in the Resume Connection dialog (Edit, Copy, Cancel, Resume)
    render at full width and function correctly

Notebooks:

  • Open a Positron notebook and verify the split button in a ghost cell or quick fix button in a cell outputrenders correctly

Plots:

  • Save a plot via the save dialog; verify the dialog buttons work

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:connections @:console @:positron-notebooks @:plots

readme  valid tags

@bricestacey

Copy link
Copy Markdown
Contributor Author

When we were looking at this, we focused mostly on the React component, but there were also some css classes for positron-button. It's worth digging into those too.

Cursory search shows up custom css in:

  • Plots
  • Assistant
  • Data explorer
  • Getting Started
  • Schema Navigation?

These selectors will no longer match and styles no longer applied.

The old PositronButton rendered a <div>, which is block-level and fills its parent's width by default. The new Button renders a <button>, which is inline-block and shrinks to fit its content. This caused the Edit button to collapse to text width. Copy and Cancel weren't affected because their container (.buttons .bottom) was already display: flex; flex-direction: column, which stretches children to full width. The Edit button's container (.buttons .top) wasn't a flex container, so the fix is to make it one to match.
@dhruvisompura

dhruvisompura commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Alrighty, I went through all the button cases and tested them + made any CSS changes needed to get them to render correctly. Still need to fix an issue in the ConsoleInstanceInfoPopup. The channel links aren't rendering in block order.

@dhruvisompura
dhruvisompura marked this pull request as ready for review April 10, 2026 00:41
The old PositronButton rendered a <div>, which is block-level and stacks vertically by default. The new Button renders a <button>, which is inline-block and sits side by side. This caused the output channel links in the console instance info popup to render horizontally instead of vertically. The fix makes .actions a flex column container so the links stack correctly.
nstrayer
nstrayer previously approved these changes Apr 10, 2026

@nstrayer nstrayer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good with one caveat around the split button component.

justify-content: center;
padding: 0 4px;
border-left: 1px solid var(--vscode-widget-border);
cursor: pointer;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This causes the right side of these buttons to not show the pointer cursor as they are not a button component. Probably should be a <button/> though.

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The props are all the same as our Button component so I think we can just replace the div with Button!

{children ?? label}
</PositronButton>
</Button>
<div

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could be converted to a Button as well but that's probably beyond this PR scope. Will need to cursor: pointer deletion reverted to keep it working fully though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was able to convert this to a button!

@nstrayer nstrayer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wonderful!

@samclark2015 samclark2015 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Checked buttons in a variety of contexts, all behaved as expected 💯

@dhruvisompura dhruvisompura added this to the 2026.05.0 Release milestone Apr 14, 2026
@dhruvisompura
dhruvisompura merged commit eea383e into main Apr 15, 2026
18 of 19 checks passed
@dhruvisompura
dhruvisompura deleted the ui-buttons branch April 15, 2026 19:08
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants