Skip to content

Desktop: fix unresponsive audio model selector on macOS - #8718

Merged
danielhanchen merged 1 commit into
unslothai:mainfrom
NilayYadav:fix-mac-audio-model-selector
Aug 14, 2026
Merged

danielhanchen merged 1 commit into
unslothai:mainfrom
NilayYadav:fix-mac-audio-model-selector

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

On macOS the Audio page's "Select audio model" trigger sits under the navbar's 34px data-tauri-drag-region strip (z-40), so clicks started a window drag instead of opening the picker. #8048 fixed the same bug on the Images/Video pages, but the Audio page (#7984) landed in parallel without that treatment. Apply the same stacking contract pointer-events-none relative z-40 on the header band, pointer-events-auto on the control group and extend.

test_media_page_headers_out_stack_the_mac_drag_region to cover the Audio page so it can't regress silently.

@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: b472661b62

ℹ️ 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".

@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: b472661b62

ℹ️ 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".

@danielhanchen
danielhanchen force-pushed the fix-mac-audio-model-selector branch from b472661 to b337d49 Compare August 14, 2026 05:53
@danielhanchen

Copy link
Copy Markdown
Member

Thanks for chasing this one down. It was a real bug and your diagnosis was right. The situation changed underneath the PR while it was open, so here is exactly where it stands after I rebased it onto current main.

The bug was real

At this PR's original base (e7ea3cb9) the Audio header band was:

<div className="relative flex h-[48px] shrink-0 items-start justify-between gap-2 ...">

relative with no z-index, so z-auto. The navbar renders a pointer-events-none absolute inset-x-0 top-0 z-40 h-[48px] wrapper whose inner strip is pointer-events-auto ... h-[34px] and carries data-tauri-drag-region. That strip is at z-40 against a band at z-auto, so it paints over the top 34px of the Audio header and takes the click. That is precisely the model selector's row, and it is why raising the band to z-40 (plus pointer-events-none on the band with pointer-events-auto opt-ins on the control groups, so the empty gaps stay draggable) is the right fix. Images and Video already had that treatment from #8048; Audio landed in parallel and missed it.

Two notes on mechanism, for the record. The strip only renders under Tauri on macOS (shouldUseNativeMacWindowTitlebar returns false when isTauri is false), which is why this is not reproducible in a browser on Linux, and I have no macOS host here. And data-tauri-drag-region is not native WKWebView hit testing: Tauri injects a script that walks e.composedPath() from the DOM hit-test target, so ordinary CSS stacking is the whole story. Nothing about the conclusion changes.

It is already fixed on main

#8445 (4b38ab1b, "Fix Audio layout and responsive media headers") landed and already applies the treatment:

<div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,408px)_minmax(13rem,1fr)]">

with pointer-events-auto on both control groups. That PR also converted the band from flex to grid, which is exactly why this PR went CONFLICTING.

After the rebase, this PR is test-only

I rebased onto current main and pushed the result. The source hunk became empty and dropped out, so git diff origin/main...HEAD is now one file:

 tests/studio/test_desktop_reliability_frontend_contract.py | 12 ++++++++----

No audio-page.tsx change at all. The PR is mergeable again and merges cleanly against main at a0c1723b.

The remaining test change is worth keeping, and it is stronger than what is on main

main's test_media_page_headers_out_stack_the_mac_drag_region only loops Images and Video, so nothing pins the Audio page. That is exactly how the regression happened in the first place. The rebased version parametrises the loop to (page, band_end, min_groups) and adds Audio.

It is also stronger than the version in the original PR. That version loosened the check (Audio min_groups=1, and it kept the narrow pointer-events-auto flex ... items-center gap- regex). Since main lays Audio and Images out as a grid, that regex no longer matches every control group. The rebased test matches on the opt-in alone and raises the counts:

Page main this PR, as filed after rebase
Images 2 2 3
Video 2 2 2
Audio not covered 1 2

Mutation table: the test has teeth

I re-ran these myself, editing studio/frontend/src/features/audio/audio-page.tsx and restoring after each, then compared against the regex the original PR used:

Mutation on the Audio band rebased test test as originally filed
baseline, no change pass pass
model-selector group loses pointer-events-auto fail fail
Create/Train pill group loses pointer-events-auto fail pass (missed)
band loses pointer-events-none fail fail
band loses z-40 fail fail
band loses relative fail fail

That third row is the one that matters: with Audio on a grid, the pill wrapper is pointer-events-auto col-start-2 justify-self-end ... and never matched the old flex-specific regex, so it could silently lose its opt-in. The broadened assertion catches it.

Full file: python -m pytest tests/studio/test_desktop_reliability_frontend_contract.py -q gives 36 passed.

Recommendation

Merge it, as a test-only change. Your commit is preserved with your authorship; only its source hunk disappeared, because main got there first.

The one thing I would ask is to reword the title and description, since the PR no longer fixes anything: something like "Cover the Audio header in the macOS drag-region contract test", noting that the fix itself shipped in #8445 and this locks it in so it cannot silently regress again. No screenshots for this one on purpose: a browser pair where both sides open the selector proves nothing, since the drag strip is not rendered outside Tauri on macOS.

The audio page fix itself landed in unslothai#8445, which rebuilt the header as the
same 408px grid rail Images uses and gave the band pointer-events-none
relative z-40 with pointer-events-auto on the control groups. What that PR
did not do was extend test_media_page_headers_out_stack_the_mac_drag_region
to the Audio page, so nothing pinned the opt-in: stripping pointer-events-auto
off the audio model selector left the whole suite green.

Parametrise the loop over the three media pages and match on the
pointer-events-auto opt-in alone rather than on one layout's flex utilities.
Audio and Images seat their mode pills in a grid cell, so the old
"pointer-events-auto flex ... items-center gap-" pattern skipped them
silently. Removing the opt-in from any of the five control groups across
Images, Video and Audio now fails the test.

The inner per-group assertion this replaces was tautological: the regex
already required the literal pointer-events-auto that it went on to assert.
@danielhanchen
danielhanchen force-pushed the fix-mac-audio-model-selector branch from b337d49 to 6600f8b Compare August 14, 2026 12:35
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 6600f8b029

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 7ae2069 into unslothai:main Aug 14, 2026
1 of 24 checks passed
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.

3 participants