Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging with NONE accept-criterion blocks / freezes application indefinitely (on client side) #4060

Closed
vaadin-bot opened this issue Jun 6, 2013 · 3 comments
Labels
Milestone

Comments

@vaadin-bot
Copy link
Collaborator

Originally by @jtreml


With a drop handler that returns NONE as an accept criterion (Not((ClientSideCriterion) AcceptAll.get())), dragging anything in the UI will stop the application from responding to any more events indefinitely until you refresh the browser.[[BR]]
[[BR]]

Online demo:[[BR]]
[http://env-2724817.jelastic.servint.net/drag-freeze/]

To reproduce:

  1. Click the button; Works as expected, brings up a notification.
  2. Drag the image (nowhere special, just a few inches from its original location).
  3. Try to click the button again; no longer works.

Demo code:

package drag.freeze;

import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion;
import com.vaadin.event.dd.acceptcriteria.Not;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.DragAndDropWrapper;
import com.vaadin.ui.DragAndDropWrapper.DragStartMode;
import com.vaadin.ui.Image;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
public class DragTestUI extends UI implements DropHandler {

    @Override
    protected void init(VaadinRequest request) {
        Image sample = new Image();
        sample.setSource(new ThemeResource("../runo/icons/64/document.png"));

        Button button = new Button("Click me!");
        button.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Notification.show("click");
            }
        });

        VerticalLayout wrapperLayout = new VerticalLayout();
        wrapperLayout.setSizeFull();
        wrapperLayout.addComponent(button);

        DragAndDropWrapper wrapper = new DragAndDropWrapper(wrapperLayout);
        wrapper.setSizeFull();
        wrapper.setDragStartMode(DragStartMode.NONE);
        wrapper.setDropHandler(this);

        VerticalLayout content = new VerticalLayout();
        content.addComponent(sample);
        content.addComponent(wrapper);
        content.setExpandRatio(wrapper, 1);
        content.setSizeFull();
        setContent(content);

    }

    @Override
    public void drop(DragAndDropEvent event) {
        // Don't do anything here. It's just an example,
    }

    @Override
    public AcceptCriterion getAcceptCriterion() {
        return new Not((ClientSideCriterion) AcceptAll.get());
    }
}

Imported from https://dev.vaadin.com/ issue #12013

@vaadin-bot
Copy link
Collaborator Author

Originally by @Wnt


Unfortunatelly I don't have time to work on this in the next few weeks.

@vaadin-bot
Copy link
Collaborator Author

Originally by @Artur-


A lot of tickets have been left hanging in the issue tracker through the years. Some of them are still relevant, some of them have been fixed a long time ago and some are no longer valid. To get a better look on what is important and still relevant, we are closing old tickets which have not been touched in a long time.

No further work will be done on this ticket unless someone indicates that it's still relevant.

If this ticket is still relevant to you, please reopen it.

@nickarls
Copy link

NB this issue is still around in the currently latest Vaadin-release

@Artur- Artur- reopened this Jan 13, 2017
Artur- added a commit to Artur-/vaadin that referenced this issue Jan 13, 2017
Artur- added a commit to Artur-/vaadin that referenced this issue Jan 17, 2017
denis-anisimov pushed a commit that referenced this issue Jan 19, 2017
* Properly end HTML5 drag operations when no drop is performed

No auto test because of SeleniumHQ/selenium#1365

Fixes #4060
@Artur- Artur- added this to the 7.7.7 milestone Feb 1, 2017
@pleku pleku closed this as completed Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants