Skip to content

Studio: quick eject from the model selector - #6654

Merged
wasimysaid merged 6 commits into
mainfrom
studio-model-selector-quick-eject
Jun 30, 2026
Merged

wasimysaid merged 6 commits into
mainfrom
studio-model-selector-quick-eject

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

Summary

Adds a one-click eject shortcut to the loaded-model pill in Studio's model selector, so you no longer need to open the picker and scroll to the "Eject model" button just to unload the current model.

What changed

  • The loaded-status indicator on the pill is now interactive. It shows a green checkmark at rest, and swaps to a red eject icon whenever you hover anywhere on the pill, with an "Eject model" tooltip. Clicking it ejects the model directly without opening the picker.
    • Hovering the icon itself shows a small circular hover background to mark the exact click target, and the rest of the pill stays unhighlighted in that case.
    • It is keyboard accessible (focus plus Enter/Space) and falls back to a plain green dot when no eject handler is available.
  • On Device tab: the search placeholder now reads "Search local models" instead of "Search Unsloth models".
  • The picker's existing "Eject model" button now uses medium font weight.

Notes

The existing "Eject model" entries inside the picker are kept as-is. The pill shortcut is an addition, and the in-picker button remains the discoverable path.

Add a one-click eject shortcut to the loaded-model pill so users do not
have to open the picker to unload a model.

- The loaded-status indicator shows a green checkmark at rest and swaps to
  a red eject icon on pill hover, with an "Eject model" tooltip. Clicking
  it ejects without opening the picker.
- On Device tab now uses the placeholder "Search local models" instead of
  "Search Unsloth models".
- The picker's "Eject model" button uses medium font weight.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces an eject model feature to the model selector UI, allowing users to eject a loaded model directly from the trigger. It also refines the search placeholder in the hub model picker based on the active section and adds font styling to the picker's eject button. However, the review points out an issue where an interactive span (acting as a button) is nested inside a native <button> element, which violates the HTML specification and can cause accessibility issues.

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.

Comment on lines +198 to +202
<span
role="button"
tabIndex={0}
aria-label="Eject model"
data-eject-hit={true}

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.

medium

Nesting an interactive element (the span with role="button" and tabIndex={0}) inside a native <button> element (the outer trigger on line 168) is invalid HTML according to the HTML specification. A <button> must not contain any interactive content descendants. This can cause unexpected behavior in screen readers and keyboard navigation.

To resolve this, consider refactoring the outer <button> on line 168 to a <div> with role="button" and tabIndex={0} (and updating the closing tag on line 272 to </div>), or restructuring the layout so that the eject button is a sibling of the popover trigger rather than nested inside it. If you use role="button" on a non-interactive element like <div>, remember to also add an onKeyDown handler for Enter and Space keys to ensure full keyboard accessibility.

References
  1. When using role='button' on non-interactive elements, ensure accessibility by adding an onKeyDown handler for Enter and Space keys and setting tabIndex={0} to make the element focusable.

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

Copy link
Copy Markdown

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: 79c43684b0

ℹ️ 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 +198 to +200
<span
role="button"
tabIndex={0}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the eject control out of the trigger button

When a model is loaded and onEject is passed, this creates a focusable role="button"/tabIndex control inside the popover trigger's outer <button>. HTML buttons cannot contain focusable descendants, so browsers and assistive tech may expose the selector/eject affordances inconsistently for keyboard and screen-reader users; please split the trigger and eject affordance into sibling controls or make the outer trigger a non-button wrapper instead of nesting this control.

Useful? React with 👍 / 👎.

The eject shortcut was a focusable span (role/tabIndex) nested inside the
trigger button. A button's content model forbids focusable descendants, so
make it a plain decorative span (aria-hidden, no role/tabIndex) that keeps
the mouse shortcut. Keyboard and screen-reader users eject via the picker's
"Eject model" button.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Thanks for the review. Both notes flagged the same valid issue: the inline eject control was a focusable span (role plus tabIndex) nested inside the trigger button, which a button's content model does not allow.

Fixed in 2a38b1b. The eject control is now a plain decorative span (aria-hidden, no role or tabIndex), so the trigger button has no focusable or interactive descendants. The mouse shortcut still works, and keyboard and screen-reader users eject via the picker's "Eject model" button, which is fully accessible.

Verified across Chromium, Firefox and WebKit with Playwright: the trigger has zero focusable/interactive descendants, the control is not in the tab order, clicking it ejects without opening the picker, and the hover icon swap and pill-hover behavior are unchanged.

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

Copy link
Copy Markdown

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: 2a38b1bdab

ℹ️ 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 +211 to +214
<HugeiconsIcon
icon={RemoveCircleIcon}
strokeWidth={1.75}
className="hidden size-3.5 text-red-500 group-hover/trigger:block"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose the eject affordance before accepting taps

On touch/mobile layouts this shortcut is still clickable, but the destructive icon is only revealed by group-hover/trigger; before the tap users see the green checkmark status icon and no native title tooltip, so tapping the left side of the selector can unload the model instead of opening the picker with no visible eject affordance. Consider disabling this inline shortcut on non-hover pointers or showing an explicit eject icon/label before it can fire.

Useful? React with 👍 / 👎.

On touch (no hover) the red eject icon and title tooltip never reveal, so
tapping the loaded pill could unload the model with no visible affordance.
Add [@media(hover:none)]:pointer-events-none so taps fall through to the
trigger and open the picker; touch users eject from the picker instead.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Good catch on the touch behavior. Confirmed it was a real footgun: on a no-hover device the red eject icon and title tooltip never reveal, yet a tap on the left of the pill still unloaded the model.

Fixed in 71c1d42 by adding [@media(hover:none)]:pointer-events-none to the inline control. On touch (no hover) the control ignores pointer events, so taps fall through to the trigger and open the picker; touch users eject from the picker's "Eject model" button. Hover-capable devices keep the shortcut unchanged.

Verified with Playwright on Chromium, Firefox and WebKit: with hasTouch the context reports hover:none, the control computes pointer-events:none, and tapping it opens the picker with zero ejects; on hover contexts pointer-events stays auto and click still ejects.

@wasimysaid
wasimysaid merged commit 0a3e5a3 into main Jun 30, 2026
37 of 40 checks passed
@wasimysaid
wasimysaid deleted the studio-model-selector-quick-eject branch June 30, 2026 14:52
Sneakr added a commit to Sneakr/unsloth that referenced this pull request Jul 4, 2026
Sync 59 upstream commits. Resolve the lone pickers.tsx conflict by fully adopting upstream quick-eject (unslothai#6654) into the refactored picker: thread onEject + RemoveCircleIcon + floating pill through HubModelPicker, wire it from model-selector, and guard the footer eject button to non-hub tabs so the hub tab shows only the pill.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants