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

Cannot Use triggerEvent with "drop" to Trigger File Upload #362

Open
jherdman opened this issue Apr 18, 2018 · 2 comments
Open

Cannot Use triggerEvent with "drop" to Trigger File Upload #362

jherdman opened this issue Apr 18, 2018 · 2 comments

Comments

@jherdman
Copy link
Contributor

It seems like triggerEvent doesn't support the "drop" event. The corresponding change would require supporting the DataTransfer event API too.

@JimSchofield
Copy link

JimSchofield commented Sep 29, 2021

I've been able to mock a dataTransfer as far as sending information from a dragstart element to drop target:

async function dragMove(fromElement, toElement) {
  const context = {};

  await triggerEvent(fromElement, 'dragstart', {
    dataTransfer: {
      setData(someKey, value) {
        context[someKey] = value;
      },
    },
  });
  await triggerEvent(toElement, 'dragover', { dataTransfer: {} });
  await triggerEvent(toElement, 'drop', {
    dataTransfer: {
      getData(someKey) {
        return context[someKey];
      },
    },
  });
}

However, my components are not handling the 'drop' event emitted by triggerEvent. I'll see if I can find a minimal reproduction.

@JimSchofield
Copy link

I've submitted a PR with a dragMove helper. Maybe this would be of help @jherdman ?

#1139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants