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

[Feature] More granular drag and drop API #16437

Open
talldan opened this issue Aug 11, 2022 · 3 comments
Open

[Feature] More granular drag and drop API #16437

talldan opened this issue Aug 11, 2022 · 3 comments

Comments

@talldan
Copy link

talldan commented Aug 11, 2022

The existing dragAndDrop api is useful, but there are a few use cases that it doesn't fulfil:

For some prior art, puppeteer has a slightly more granular API:

// Requires `page.setDragInterception( true )` in test setup
const dragData = await page.mouse.drag( sourceElementHandle, target );
await page.mouse.dragEnter( target, dragData );
await page.mouse.dragOver( target, dragData );
expect( dropZone ).toBeVisible(); // this line is pseudocode, I don't think puppeteer supports `toBeVisible`.
await page.mouse.drop( target, dragData );

Another idea is an API like:

const { dragTo, drop } = await drag( locator );

or

const { dragTo, drop } = await dragFile( file );

Where the transferData is encapsulated using a closure and doesn't need to be passed to each function.

(credit to @kevin940726 for the latter idea in WordPress/gutenberg#42722)

@rwoll
Copy link
Member

rwoll commented Aug 11, 2022

Added collecting feedback label. Thanks for the request!

Is this something you'd be interested in working on a PR for? If so, we can iterate on the API to ensure it's something Playwright would accept before starting the implemention.

Thanks!

@talldan
Copy link
Author

talldan commented Aug 17, 2022

Is this something you'd be interested in working on a PR for?

Yep, that's a possibility. It'd be a first code contribution, so it would probably need a lot of iteration 😄

@delijah
Copy link

delijah commented Oct 10, 2023

Any progress on this?

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

No branches or pull requests

3 participants