<dialog> elements can be anchored to other elements, specified in the call show/showModal(): dialog.show(anchor); The spec calls this magical alignment: http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#magically-aligned
Created attachment 176914 [details] work in progress patch
This patch is very much a WIP but I hope it can spark some discussion. I think the anchored positioning step must occur after normal layout, or else we don't know where the anchor itself is be positioned. The tricky part is that an anchor can itself be anchored to something else (or it may be in the subtree of an anchored object). So the order in which the anchored objects are processed is important. This WIP patch simply traverses the render tree but this is incorrect. The order of anchoring has nothing to do with the render tree structure. I think we need to somehow build a anchored object tree, and then traverse that instead.
If the anchor target is being animated, should the dialog also move around?
(In reply to comment #3) > If the anchor target is being animated, should the dialog also move around? Yes, I think so. If I'm interpreting the spec correctly, the dialog follows the anchor if its position is changed dynamically. It looks like animations can be considered the same thing. Is it more difficult to handle following an animated anchor?
(In reply to comment #4) > (In reply to comment #3) > > If the anchor target is being animated, should the dialog also move around? > > Yes, I think so. If I'm interpreting the spec correctly, the dialog follows the anchor if its position is changed dynamically. It looks like animations can be considered the same thing. > > Is it more difficult to handle following an animated anchor? Yes, in some cases. You also need to consider the effects of CSS transforms on your target.
This has been removed from the spec.