W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2012

Re: [whatwg] Magical alignment and moving anchor targets

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 11 Dec 2012 13:30:50 -0800
Message-ID: <CAAWBYDCE=qBay6muUx4oxJKyJBrU8O1_E4uM+C94TrybLL6JGQ@mail.gmail.com>
To: Matt Falkenhagen <falken@chromium.org>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Tue, Dec 11, 2012 at 10:45 AM, Matt Falkenhagen <falken@chromium.org> wrote:
> The spec seems unclear on whether a magically aligned element[1] should
> follow its anchor when its anchor moves, e.g., by dynamic style changes or
> something like CSS animations.
>
> I think we want the element to follow the anchor. If someone does something
> like:
>
> dialog.show(anchor)
> anchor.style.top = ...
>
> They'd probably expect dialog to end up where anchor is, rather than where
> it was when show() was called.

Yes, it should follow.  The only reason it wouldn't do that is it were
explained in terms of a one-shot adjustment of top/left.  The fact
that it's done in terms of a (not yet specced) anchoring functionality
means that as long as the anchor is specified, the two elements should
have the correct relationship.

> Relatedly, it's not clear what happens if anchor is display: none or is not
> in the document when show() is called, but later has a rendered box and is
> in the document. And the reverse: if it is in the document when show() is
> called and later is removed.

The spec defines this - the magical alignment only happens while A and
B have rendered boxes.  When the conditions don't apply, it's not
magically aligned.  (The spec's recommendation for CSS is somewhat
badly designed for this - assume that it merely forces A to
"position:absolute", and while B doesn't have a box, A isn't anchored
and is interpreted as a normal abspos box.)

~TJ
Received on Tuesday, 11 December 2012 21:31:40 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:18 UTC