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

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

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Tue, 14 Aug 2012 12:13:09 -0700
Message-ID: <CABNRm62pZr3jwTb0US_ozQh69ZP5w9QqM4E9sewVEu0jfwA19Q@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: fantasai <fantasai.lists@inkedblade.net>, whatwg@lists.whatwg.org, "www-style@w3.org" <www-style@w3.org>
On Tue, Aug 14, 2012 at 11:04 AM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Mon, Aug 13, 2012 at 11:55 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> > On Mon, Aug 13, 2012 at 9:19 PM, fantasai <fantasai.lists@inkedblade.net
> >wrote:
> >> The CSSWG discussed drag-and-drop pseudo-classes today. The current
> >> proposal is to have three pseudo-classes:
> >>
> >>   * One for the element representing the drop target that
> >>     would receive the item if it were dropped.
> >>   * One for all elements representing possible drop targets
> >>     that could receive the item.
> >
> > How do we find these elements? On one hand, if we're only supporting
> > dropzone attribute, then adding new pseudo element seems unnecessary. On
> > the other hand, I can't think of ways to detect whether an element could
> > return false or prevents the default action on dragover/dragenter events
> > without firing those events.
>
> Just using [dropzone], yes.
>
> We're not adding a pseudo-element, we're adding pseudo-classes.
>
> I'm not sure how we can possibly do these without pseudo-classes.  Can
> you outline what you think it would be?


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.

http://dev.w3.org/csswg/selectors4/#drag-pseudos says
The :valid-drop-target pseudo-class represents an element that is a
possible drop target for an item that is currently being dragged in a
drag-and-drop interface.

How are we going to figure out whether a given element is a possible drop
target for an item, when the element can dynamically decide whether to
accept the item or not in dragenter/dragover events?

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.

- Ryosuke
Received on Tuesday, 14 August 2012 19:13:58 GMT

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