Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/purple-lions-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-react": patch
---

**Dialog**: fixed non-modal Dialog not opening when using `Dialog.Trigger`
2 changes: 1 addition & 1 deletion packages/react/src/components/dialog/dialog-trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const DialogTrigger = forwardRef<HTMLButtonElement, DialogTriggerProps>(
return (
<Component
suppressHydrationWarning // Might get augmented through designsystemet-web with aria-haspopup
command={modal ? 'show-modal' : 'show'}
command={modal ? 'show-modal' : '--show-non-modal'}
commandfor={id}
ref={ref}
{...rest}
Expand Down
15 changes: 15 additions & 0 deletions packages/react/src/components/dialog/dialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,21 @@ export const DialogNonModal: StoryFn<typeof Dialog> = () => {
</>
);
};
export const DialogNonModalTrigger: StoryFn<typeof Dialog> = () => (
<Dialog.TriggerContext>
<Dialog.Trigger>Open non-modal dialog</Dialog.Trigger>
<Dialog modal={false}>
<Heading style={{ marginBottom: 'var(--ds-size-4)' }}>
Let us know
</Heading>
<Paragraph style={{ marginBottom: 'var(--ds-size-4)' }}>
We’d love to hear your feedback on our new design system. Please let us
know what you think!
</Paragraph>
<Button variant='primary'>Give feedback</Button>
</Dialog>
</Dialog.TriggerContext>
);

export const DialogNonModalRef: StoryFn<typeof Dialog> = () => {
const dialogRef = useRef<HTMLDialogElement>(null);
Expand Down
Loading