Feature request: Dropdown position auto based on container rather than viewport

Maybe there is already a way of achieving this, but I am putting together a image hotspots component, and I would like the dropdowns to be auto positioned to fit within the image container div, rather than based on width of viewport or scroll depth.

Currently, the dropdowns flow out of the image container:

And I would like for a way to use the auto position to keep it within the image div:

Is there already a way to do this by adding some CSS to the container? Or would it need to be a feature added to the dropdown js?

Thanks!

For some additional info, here is the structure of this Image with Hotspots component:

The image sets the size, with the Hotspots div positioned absolute to fill the container.
The hotspot items are then dropdowns positioned accordingly (via % to scale with the image)

That’s a good idea. However I’m not sure how’d we control which container to use though without a way to select elements on the page like I describe here Feature request: link type control - open a modal on click . I’ll think on it. Have a great day.

Ah yes that’s a good point.

Short of a way to target dynamic elements on the page, would specifying an ID to act as the container work?
A little more manual to set up, but for this sort of thing it might work