EnxDev commented on code in PR #42614:
URL: https://github.com/apache/superset/pull/42614#discussion_r3684519185
##########
superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.tsx:
##########
@@ -48,12 +49,31 @@ export type PopoverProps = BasePopoverProps & {
getVisibilityRatio?: typeof getElementVisibilityRatio;
};
+/** Placements antd already shifts, capped so the arrow keeps touching its
trigger. */
+const SHIFTING_PLACEMENTS = new Set(['top', 'bottom', 'left', 'right']);
+
+// `shiftX`/`shiftY` work but are missing from `AdjustOverflow`, hence the
cast.
+export const SHIFT_INTO_VIEWPORT = {
+ adjustX: 1,
+ adjustY: 1,
+ shiftX: true,
+ shiftY: true,
+} as unknown as BasePopoverProps['autoAdjustOverflow'];
+
+// The other placements can flip a popup across its trigger but never nudge it
back
+// into the viewport, leaving an oversized one stranded off screen. Only they
opt in:
+// lifting the cap above would let those popups slide off a trigger scrolled
out of
+// view, taking the arrow away from what it points at.
+export const getAutoAdjustOverflow = (placement: TooltipPlacement) =>
Review Comment:
Fair point, and I've narrowed the change based on your comment.
It now applies only to corner placements. The four base placements (`top`,
`bottom`, `left`, `right`) keep Ant Design's existing numeric cap, which
prevents the popup from shifting too far when the trigger is scrolled out of
view. Corner placements don't have this shift behavior by default, which is
what caused the annotation popover issue, so they're the only ones opting in.
It's still a global change, though, so I've added a note to the PR
description.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]