Repository navigation
Studio: clickable sidebar settings cog, long name truncation, Canvas menu opt-in - #7171
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the settings cog in the application sidebar to act as an interactive button that directly opens the settings dialog, adding accessibility attributes and event handlers. The review feedback correctly identifies that calling e.preventDefault() on pointerdown prevents the element from gaining focus, which breaks the dialog's focus restoration mechanism when closed.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| onPointerDown={(e) => { | ||
| // Radix opens the dropdown on pointerdown; block it. | ||
| e.stopPropagation(); | ||
| e.preventDefault(); | ||
| }} |
There was a problem hiding this comment.
Calling e.preventDefault() on pointerdown prevents the settings cog from gaining focus when clicked. This breaks the dialog's focus restoration mechanism (captureOpener()), which relies on document.activeElement being the clicked element to restore focus back to the cog when the settings dialog is closed.
To fix this, only call e.stopPropagation() to prevent the Radix dropdown from opening, and allow the default focus behavior to occur.
| onPointerDown={(e) => { | |
| // Radix opens the dropdown on pointerdown; block it. | |
| e.stopPropagation(); | |
| e.preventDefault(); | |
| }} | |
| onPointerDown={(e) => { | |
| // Radix opens the dropdown on pointerdown; block it. | |
| e.stopPropagation(); | |
| }} |
There was a problem hiding this comment.
Good catch, verified: captureOpener() in settings-dialog-store.ts reads document.activeElement at openDialog time, so preventDefault on pointerdown did break focus restoration. Fixed by restructuring the cog as a sibling button of the trigger (see latest commit), so it gains focus natively and no pointerdown handling is needed at all.
|
Pushed a follow up: very long profile names were pushing the cog out of the row since the name column had no width constraint. Added min-w-0 flex-1 to the name column so the name truncates with an ellipsis and the cog stays pinned on the right. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a0d2726e7
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| role="button" | ||
| tabIndex={0} |
There was a problem hiding this comment.
Avoid nesting the settings control inside the trigger
SidebarMenuButton renders a native <button> when asChild is false (components/ui/sidebar.tsx), so adding a focusable span role="button" here still creates an interactive descendant inside the account-menu button. HTML forbids focusable descendants inside buttons, and keyboard/screen-reader behavior can become inconsistent for users trying to tab to or activate the cog as a separate control. Consider rendering the row trigger as a non-button wrapper or moving the cog to a sibling control instead of nesting it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. SidebarMenuButton renders a native button here, so a focusable descendant was invalid HTML. Moved the cog out of the trigger entirely: it is now a real button sibling inside SidebarMenuItem (which is position relative), absolutely positioned over the right edge of the row, following the same pattern as SidebarMenuAction. The trigger button reserves right padding so long names still truncate before the cog.
… in the account trigger
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd9cc848d3
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| codeToolsEnabled: loadBool(CHAT_CODE_TOOLS_ENABLED_KEY, false), | ||
| imageToolsEnabled: loadBool(CHAT_IMAGE_TOOLS_ENABLED_KEY, false), | ||
| artifactsEnabled: loadBool(CHAT_ARTIFACTS_ENABLED_KEY, false), | ||
| showCanvasMenuItem: loadBool(CHAT_SHOW_CANVAS_MENU_ITEM_KEY, false), |
There was a problem hiding this comment.
Preserve existing Canvas menu pins on upgrade
For profiles that already persisted unsloth_plus_menu_pins with pins.canvas: true, this new flag is absent, so loadBool(..., false) initializes showCanvasMenuItem to false and the composer menus now render the canvas node as null. Upgrading therefore hides the Canvas action for users who explicitly pinned it before; consider deriving or migrating the initial value from the existing plus-menu pin when the new key is missing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, verified: loadBool falls back to false when the key is absent, so profiles with pins.canvas true would have lost the item on upgrade. Fixed: when the visibility flag is missing from localStorage, it now derives from the persisted plus-menu pin, so anyone who explicitly pinned Canvas keeps it visible. An explicitly saved flag still wins once the user toggles it either way.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aad11f4ef1
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ), | ||
| canvas: ( | ||
| // Hidden by default; enabled from Settings > Chat > Canvas. | ||
| canvas: showCanvasMenuItem ? ( |
There was a problem hiding this comment.
Filter hidden Canvas out of the menu item lists
When Canvas is disabled, this makes plusMenuNodes.canvas null while PLUS_MENU_ORDER still includes canvas in pinnedPlusItems/overflowPlusItems. If a user pins every other configurable item with Canvas off, overflowPlusItems.length is still 1, so the + menu renders a More submenu with no entries; the compare composer has the same pattern. Please exclude hidden items before computing/rendering pinned and overflow menus.
Useful? React with 👍 / 👎.
test_sidebar_account_block_uses_leading_tight hardcoded flex flex-col adjacency, but the account-block divs in app-sidebar.tsx now carry min-w-0 (and flex-1) between flex and flex-col following the sidebar truncation work (unslothai#7171). The leading-tight class is still present, so this is a stale test rather than a UI regression. Loosen the regex to allow the extra layout utilities while still asserting the leading-* class the guard exists for.
What
Started as a sidebar polish and grew into a set of small chat shell fixes: the account row settings cog is now a real control that opens settings directly, long profile names truncate instead of breaking layouts, and the Canvas chat menu item is hidden by default behind a settings opt-in.
Changes
Sidebar account row
aria-hiddenspan inside the account dropdown trigger. It is now a real<button>rendered as a sibling of the trigger (nested buttons are invalid HTML), absolutely positioned over the right edge of the row, following the same pattern asSidebarMenuAction. Clicking it opens the settings dialog directly viauseSettingsDialogStore.getState().openDialog(); clicking the rest of the row still opens the account menu.rounded-full,hover:bg-black/10,dark:hover:bg-white/10) plus a focus-visible ring andaria-label. As a native button it gains focus normally, so the dialog'scaptureOpener()focus restoration works.min-w-0 flex-1and the trigger reserves right padding, so very long profile names truncate with an ellipsis instead of pushing the cog out of the row.Welcome greeting
Canvas chat menu item
unsloth_chat_show_canvas_menu_item).artifactsEnabledbehavior itself is unchanged: the render_html tool exposure, canvas instruction, in-place code collapsing, and the composer pill all work as before for users who have it on.Testing
npm run build(tsc + vite) passes.