Nested buttons from TooltipTrigger without asChild

Open Beginner friendly
#5,302 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
73/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript

Research direction

Start with packages/client/src/components/ui/tooltip.tsx and inspect the listed TooltipTrigger usages in merge-charges/index.tsx, download-csv-button.tsx, close-document-button.tsx, preview-document-modal.tsx, and template-manager.tsx. Check the existing component tests or stories, then verify the All Charges page and Charges and Balance tabs for nesting warnings and tooltip behavior on disabled buttons. Done when those warnings are gone and a test or story covers the disabled tooltip case.

Written by the indexing model from the issue text.

Description

Problem

Some uses of the shadcn TooltipTrigger (packages/client/src/components/ui/tooltip.tsx) omit asChild. The Radix trigger renders its own <button>, so when it wraps a <Button> the page contains a button inside a button. React logs a validateDOMNesting warning, and the markup is invalid HTML (focus and click handling can misbehave).

Confirmed in a browser:

  • packages/client/src/components/common/merge-charges/index.tsx (MergeChargesButton): DialogTrigger → TooltipTrigger → Button, three buttons deep. It shows on every charges table with merge selection (All Charges, business and tax category Charges tabs, …).
  • packages/client/src/components/common/buttons/download-csv-button.tsx (DownloadCSVButton): TooltipTrigger → Button. It shows on business-ledger balance views (the business and tax category Balance tabs and the full-screen ledger).

Other <TooltipTrigger> uses without asChild to check:

  • packages/client/src/components/common/buttons/close-document-button.tsx (two)
  • packages/client/src/components/common/modals/preview-document-modal.tsx
  • packages/client/src/components/reports/dynamic-report/dialogs/template-manager.tsx

Fix

Use <TooltipTrigger asChild> around the button. A disabled <button> fires no pointer events, so where the tooltip has to show while the button is disabled (the merge button explains why merging is unavailable; the CSV button says "Preparing download…"), wrap the button in a <span> and make the span the asChild trigger. Nested triggers (DialogTrigger inside TooltipTrigger) each need asChild.

Done when

No validateDOMNesting warning on the All Charges page or the Charges and Balance tabs. The tooltips still show, including on disabled buttons, and there is a test or story for the disabled-tooltip case.

Dominant language
TypeScript
Stars
30
Forks
10
Avg merge
2d 12h
Merged PRs (30d)
276

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Urigo/accounter-fullstack

All issues in Urigo/accounter-fullstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.