Skip to content

[📖 Docs]: dragAndDrop: emphasize that the target element must be awaited  #14055

@htho

Description

@htho

Pre-check

  • I know I can edit the docs but prefer to file this issue

Describe the improvement

Unclear documentation

Description of the improvement / report

I read the documentation a few times, but missed that the target element must be awaited for dragAndDrop to work.

await $("#elementToDrag").dragAndDrop($("#dropTarget")); // fails
await $("#elementToDrag").dragAndDrop(await $("#dropTarget")); // works - but TypeScript says the await is not needed

On the other hand the documentation awaits $("#someElem") but that is not needed.

I suggest to write the example like this:

it('should demonstrate the dragAndDrop command', async () => {
    const elem = $('#someElem')
    const target = $('#someTarget')

    // drag and drop to other element
    await elem.dragAndDrop(await target); // target MUST be awaited!

    // drag and drop relative from current position
    await elem.dragAndDrop({ x: 100, y: 200 })
})

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions