ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: How to change HTML tag for AccordionTrigger to a div, so that buttons can be nested.

Open Michael-Crowther opened this issue 1 year ago • 2 comments

Describe the bug

I'm trying to nest buttons inside of the AccordionTrigger to trigger popovers with useful information to my users. By default, AccordionTrigger is an 'HTMLButtonElement'. Is there any way to change this to a 'div' that has an onClick event, while still controlling the open and close state of the Accordion? I'm asking to avoid the attached console error. Screenshot 2024-06-28 at 2 35 37 PM

Affected component/components

Accordion, AccordionTrigger

How to reproduce

Nest a 'Button' element as a child of 'AccordionTrigger'

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Using MacOS, Brave Browser

Before submitting

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

Michael-Crowther avatar Jun 28 '24 20:06 Michael-Crowther

same issue for me aswell

shrix1 avatar Jun 28 '24 21:06 shrix1

i change inside button to span with buttonVariants

<span className={cn(buttonVariants({ variant: "outline", size: "icon" }), "size-5 rounded-none shadow-none mr-1")}>
    <Plus className="size-4 text-accent-foreground/50" onClick={() => alert("ok")} />
</span>

WangLarry avatar Jun 29 '24 02:06 WangLarry