Skip to content

Commit 5bad4eb

Browse files
fix: collapsible trigger has correct id (#1012)
* fix: collapsible trigger has correct id * changeset --------- Co-authored-by: jack shelton <[email protected]>
1 parent a6945e2 commit 5bad4eb

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.changeset/real-chairs-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik-ui/headless': patch
3+
---
4+
5+
fix: collapsible trigger has correct label
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export const api = {
2+
collapsible: [
3+
{
4+
'collapsible-content': [],
5+
},
6+
{
7+
'collapsible-trigger': [],
8+
},
9+
{
10+
collapsible: [
11+
{
12+
CollapsibleProps: [
13+
{
14+
comment: '@deprecated use `onChange$` instead',
15+
prop: 'onOpenChange$',
16+
type: 'QRL<(open: boolean) => void>',
17+
},
18+
],
19+
},
20+
],
21+
},
22+
{
23+
'use-collapsible': [],
24+
},
25+
],
26+
};

packages/kit-headless/src/components/collapsible/collapsible-trigger.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const HCollapsibleTrigger = component$<PropsOf<'button'>>(
55
({ onClick$, ...props }) => {
66
const context = useContext(collapsibleContextId);
77
const contentId = `${context.itemId}-content`;
8+
const triggerId = `${context.itemId}-trigger`;
89

910
const handleClick$ = $(async () => {
1011
if (context.isOpenSig.value && context.collapsible === false) return;
@@ -16,6 +17,7 @@ export const HCollapsibleTrigger = component$<PropsOf<'button'>>(
1617
return (
1718
<button
1819
{...props}
20+
id={triggerId}
1921
ref={context.triggerRef}
2022
disabled={context.disabled}
2123
data-disabled={context.disabled ? '' : undefined}

0 commit comments

Comments
 (0)