fix: resolve nested button DOM nesting in approval pill

Change the approval group header from <button> to a <div> with
role='button' and keyboard handling to avoid nesting the GroupToggle
<button> inside another <button>, which is invalid HTML.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-28 19:33:41 +01:00
co-authored by Copilot
parent b4b0bf54d2
commit 6505493735
+6 -4
View File
@@ -540,10 +540,12 @@ export function InlineApprovalPill({
{group.label} {group.label}
</div> </div>
) : ( ) : (
<button <div
className={`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left transition hover:bg-zinc-800/60 ${groupIdx > 0 ? 'mt-0.5' : ''}`} className={`flex w-full cursor-pointer items-center gap-1.5 px-2.5 py-1.5 text-left transition hover:bg-zinc-800/60 ${groupIdx > 0 ? 'mt-0.5' : ''}`}
onClick={() => toggleExpanded(group.id)} onClick={() => toggleExpanded(group.id)}
type="button" onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleExpanded(group.id); } }}
role="button"
tabIndex={0}
> >
{group.tools.length > 0 ? ( {group.tools.length > 0 ? (
<ChevronRight className={`size-3 shrink-0 text-zinc-600 transition ${expanded ? 'rotate-90' : ''}`} /> <ChevronRight className={`size-3 shrink-0 text-zinc-600 transition ${expanded ? 'rotate-90' : ''}`} />
@@ -559,7 +561,7 @@ export function InlineApprovalPill({
someApproved={someApproved} someApproved={someApproved}
onToggle={(e) => { e.stopPropagation(); toggleGroup(group); }} onToggle={(e) => { e.stopPropagation(); toggleGroup(group); }}
/> />
</button> </div>
)} )}
{/* Group tools */} {/* Group tools */}