Allow an arrow to be added to popover component - #2011
Conversation
fb669c5 to
d2f0429
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2011 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 70 70
Lines 1319 1329 +10
Branches 489 497 +8
=========================================
+ Hits 1319 1329 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
636447c to
9e542b0
Compare
| variant === 'panel' && [ | ||
| 'max-h-80 overflow-y-auto overflow-x-hidden', | ||
| 'rounded border bg-white shadow hover:shadow-md focus-within:shadow-md', | ||
| ], |
There was a problem hiding this comment.
The outermost Popover element is now "unstyled", and there's a new inner element wrapping children which is the one receiving styling classes.
This allows the arrow to be displayed inside the "unstyled" container, and keep the other one looking as before.
There's one consideration. The classes prop, which intuitively one would expect to be added to the outermost element, is now added to the "styled" inner element, to ensure it keeps looking the same. Maybe we should document this in the prop and in future we can add a new containerClasses prop if we need to provide classes to the outermost element.
Thanks! Good catch. |
robertknight
left a comment
There was a problem hiding this comment.
The main feedback I have is to avoid using the word "arrowed". Use the phrase "Popover with arrow" in the example and either arrow or showArrow or withArrow as the prop name. I also found a render issue in Safari that seems to occur when the popover's calculated top position is not a whole number of pixels. Changing the value so that it is a whole number of pixels resolves the issue.

Add new
arrowed?: booleanprop toPopoverthat allows an arrow/triangle pointing to the anchor element to be rendered.The arrow is aligned to the same side as the popover, and points up or down depending on the Popover placement.
popover-arrow-2025-06-17_15.38.44.mp4
The functionality is very simple at this point and is not very customizable, but let's wait to see what new requirements appear before making it more complex.
Our initial use case is using the Popover for the share annotation behavior in the sidebar and the moderation queue. This is how it looks with the code from this PR:
popover-arrow-sidebar-2025-06-17_15.43.14.mp4
Tip
This PR is easier to review ignoring whitespaces
TODO