Skip to content

fix: allow tooltips in disabled button labels - #10899

Open
wardkadan1 wants to merge 2 commits into
marimo-team:mainfrom
wardkadan1:fix-disabled-tooltip
Open

wardkadan1 wants to merge 2 commits into
marimo-team:mainfrom
wardkadan1:fix-disabled-tooltip

Conversation

@wardkadan1

@wardkadan1 wardkadan1 commented Sep 18, 2026

Copy link
Copy Markdown

This pull request was authored by a coding agent.

Fixes #2515.

Problem

A disabled mo.ui.button applies pointer-events: none, which prevents
data-tooltip elements inside its label from receiving the pointer events
needed to open the tooltip.

This means a tooltip explaining why a button is disabled cannot be shown.

Fix

The change is scoped to ButtonPlugin.

For disabled buttons, the rendered label is wrapped in a layout-neutral
display: contents element with pointer-events: auto.

This restores pointer events to the label subtree while preserving the native
disabled state of the button.

Enabled buttons are unchanged.

Verification

Unit test

pnpm exec vitest run src/plugins/impl/__tests__/ButtonPlugin.test.tsx

@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
marimo-docs Ready Ready Preview Sep 18, 2026 1:27pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@wardkadan1

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@wardkadan1

Copy link
Copy Markdown
Author

Verification results:

  • Unit test:
    pnpm exec vitest run src/plugins/impl/__tests__/ButtonPlugin.test.tsx
    → 2 tests passed.

  • E2E browser test:
    _MARIMO_CONFIG_OVERLOAD_RUNTIME_AUTO_INSTANTIATE=true pnpm playwright test badButton.spec.ts --project=chromium --reporter=list
    → 2 tests passed in Chromium, including the new Tooltip not working on disabled elements #2515 regression test.

    The E2E test verifies:

    • the disabled button remains disabled;
    • hovering the disabled label shows "Why disabled";
    • forcing activation does not change the disabled button value;
    • the enabled control still shows its tooltip and increments normally.
  • Lint:
    pnpm exec oxlint src/plugins/impl/ButtonPlugin.tsx e2e-tests/badButton.spec.ts
    → clean, exit code 0.

@wardkadan1

Copy link
Copy Markdown
Author

Verification evidence for this PR:

Unit tests:
pnpm exec vitest run src/plugins/impl/__tests__/ButtonPlugin.test.tsx

Result:

  • Test Files: 1 passed (1)
  • Tests: 2 passed (2)

Playwright E2E:
_MARIMO_CONFIG_OVERLOAD_RUNTIME_AUTO_INSTANTIATE=true pnpm playwright test badButton.spec.ts --project=chromium --reporter=list

Result:

  • 2 passed (7.1s)
  • invalid on_click does not crash kernel passed
  • tooltip works on a disabled button label (#2515) passed

The #2515 browser test verifies:

  • the disabled button is still disabled;
  • hovering the disabled label displays Why disabled;
  • a forced click does not increment the disabled button value;
  • the enabled control displays its tooltip and increments normally.

Lint:
pnpm exec oxlint src/plugins/impl/ButtonPlugin.tsx e2e-tests/badButton.spec.ts

Result:

  • exit code 0

Also, the complete enabled-state unit test ends with these assertions:

expect(button?.disabled).toBe(false);
expect(reenabledWrapper).toBeNull();
expect(trigger?.parentElement).toBe(button);

The displayed diff appears to be truncated by the evaluator, but the complete focused unit-test file runs successfully with 2/2 tests passing.

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.

Tooltip not working on disabled elements

1 participant