W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [whatwg] [selectors4] drag-and-drop pseudo-classes

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 14 Aug 2012 12:53:53 -0700
Message-ID: <CAAWBYDBaj71vmegkmMehkYA8CW3cqLr+rLemqs1rBWf4m+mejA@mail.gmail.com>
To: Ryosuke Niwa <rniwa@webkit.org>
Cc: fantasai <fantasai.lists@inkedblade.net>, whatwg@lists.whatwg.org, "www-style@w3.org" <www-style@w3.org>
On Tue, Aug 14, 2012 at 12:13 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> I'm asking how we're supposed to implement this pseudo-classes given that
> the only way to know whether an element can receive the item is by firing
> dragenter and/or dragover events. e.g.

No, we can know it declaratively via the dropzone attribute.  That's
what these will key off of in HTML.  In @dropzone, you can declare the
types of data that it will accept, and you know the type of the data
as soon as the drag starts, so you have all the info you need.

We obviously can't address "dropzones" that are only detectable during
the dragover event.  That's fine - they just won't respond to these
pseudo-classes.  Consider it an inducement to use the new, better
model that @dropzone allows.


>> As well, the pseudo that matches "the drop target that will be used if
>> you dropped right now" might not be expressible in pure CSS even given
>> the above.  It's probably equivalent to "when you :hover it", but
>> there are applications that basically have this functionality that
>> work differently - for example, I think that the built-in Windows
>> solitaire game highlight the closest drop target to the current mouse
>> pointer, even if you're nowhere near the actual drop zone.
>
> Yeah, and that's not compatible with how drag and drop are implemented on
> the Web.

I know.  You'll notice that I didn't suggest we somehow change to
that.  ^_^  However, other languages might want this kind of model,
and we could in the future add a switch to allow this kind of behavior
in HTML. My point is just that, even if you solve the other problems,
you still might not be able to implement that pseudoclass in existing
CSS.

~TJ
Received on Tuesday, 14 August 2012 19:54:40 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT