Skip to content

Commit

Permalink
[DS-379] Add a warning for misuse of Popover (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
victortrinh2 authored Oct 21, 2024
1 parent 5b96aca commit d576821
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-cheetahs-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workleap/orbiter-ui": patch
---

Add a warning when user doesn't add a Heading or an aria-label attribute to a Popover
4 changes: 4 additions & 0 deletions packages/components/src/popover/src/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ export function InnerPopover({
}
}), [popoverId]));

if (isNil(heading) && isNil(ariaLabel)) {
console.error("A popover must either have a heading or an \"aria-label\" attribute.");
}

const headingId = heading?.props?.id;

const footerMarkup = isString(footer?.props?.children)
Expand Down

0 comments on commit d576821

Please sign in to comment.