DnD in Chrome highlight all screen

48 views
Skip to first unread message

Nihad

unread,
Mar 3, 2015, 6:44:25 AM3/3/15
to gwt...@googlegroups.com
Hi Guys,

I implemented DnD in my GWT application. It works absolutely fine but when I start to drag in Chrome it highlight all the screen. How can I solve this problem? Any suggestions?  

Carl Rahmström

unread,
Mar 3, 2015, 6:48:29 AM3/3/15
to gwt...@googlegroups.com
In your css you can add the following. If you need to be able to select something other than inputs and textareas mark them with .user-select.

*:not(input):not(textarea) {

-webkit-touch-callout: none;

    -webkit-user-select: none;

    -khtml-user-select: none;

    -moz-user-select: none;

    -ms-user-select: none;

    user-select: none;

}


.user-select {

-webkit-touch-callout: auto;

    -webkit-user-select: auto;

    -khtml-user-select: auto;

    -moz-user-select: auto;

    -ms-user-select: auto;

    user-select: auto;

}


.user-select * {

-webkit-touch-callout: auto;

    -webkit-user-select: auto;

    -khtml-user-select: auto;

    -moz-user-select: auto;

    -ms-user-select: auto;

    user-select: auto;

}


On Tue, Mar 3, 2015 at 12:44 PM, Nihad <niha...@gmail.com> wrote:
Hi Guys,

I implemented DnD in my GWT application. It works absolutely fine but when I start to drag in Chrome it highlight all the screen. How can I solve this problem? Any suggestions?  

--
You received this message because you are subscribed to the Google Groups "gwt-dnd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-dnd+u...@googlegroups.com.
To post to this group, send email to gwt...@googlegroups.com.
Visit this group at http://groups.google.com/group/gwt-dnd.
For more options, visit https://groups.google.com/d/optout.

Fred Sauer

unread,
Mar 7, 2015, 2:18:19 PM3/7/15
to gwt...@googlegroups.com
Did you see DragController#setBehaviorCancelDocumentSelections() ?

Shawn Quinn

unread,
Mar 10, 2015, 1:14:08 AM3/10/15
to gwt...@googlegroups.com, fr...@allen-sauer.com
The DragController#setBehaviorCancelDocumentSelections() method seemed to work in Firefox, but not in the current version of Chrome (at least in my test). I found the following to work pretty well though:

In my CSS:

.unselectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

And in my code:

dragController = new PickupDragController(RootPanel.get(), true);
dragController.setBehaviorCancelDocumentSelections(true);
dragController.addDragHandler(new DragHandler() {
    @Override
    public void onDragEnd(DragEndEvent event) {
        RootPanel.get().removeStyleName("unselectable");
    }

    @Override
    public void onDragStart(DragStartEvent event) {
        RootPanel.get().addStyleName("unselectable");
    }

    @Override
    public void onPreviewDragEnd(DragEndEvent event) throws VetoDragException {
        // Purposefully empty
    }

    @Override
    public void onPreviewDragStart(DragStartEvent event) throws VetoDragException {
        // Purposefully empty
    }
});

Hope that helps,

      -Shawn

Nihad

unread,
Mar 24, 2015, 9:21:07 AM3/24/15
to gwt...@googlegroups.com
Thanks to everyone for help. I updated Chrome to latest version and it works fine. 
Reply all
Reply to author
Forward
0 new messages