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

[Bug]: draggableElement is null #2478

Closed
1 task done
Ludy87 opened this issue Dec 17, 2024 · 1 comment · Fixed by #2485
Closed
1 task done

[Bug]: draggableElement is null #2478

Ludy87 opened this issue Dec 17, 2024 · 1 comment · Fixed by #2485
Labels
Bug Something isn't working Front End Issues or pull requests related to front-end development Priority: Medium Issues or pull requests with medium priority

Comments

@Ludy87
Copy link
Contributor

Ludy87 commented Dec 17, 2024

Installation Method

None

The Problem

The draggableElement is called before it is created.

Uncaught TypeError: draggableElement is null
    <anonymous> http://127.0.0.1:8080/js/draggable.js:6
[draggable.js:6:1](http://127.0.0.1:8080/js/draggable.js)
    <anonym> http://127.0.0.1:8080/js/draggable.js:6

Version of Stirling-PDF

0.36.3

Last Working Version of Stirling-PDF

No response

Page Where the Problem Occurred

http://127.0.0.1:8080/sign

Docker Configuration

No response

Relevant Log Output

No response

Additional Information

No response

Browsers Affected

Firefox, Chrome, Safari, Microsoft Edge, Other

No Duplicate of the Issue

  • I have verified that there are no existing issues raised related to my problem.
@Ludy87 Ludy87 added Bug Something isn't working Priority: Medium Issues or pull requests with medium priority labels Dec 17, 2024
Copy link

dosubot bot commented Dec 17, 2024

The error you're encountering suggests that the draggableElement is being accessed before it is properly initialized. This can happen if the script is executed before the DOM is fully loaded. To resolve this, ensure that the script is executed after the DOM is ready. You can do this by wrapping the initialization code in a DOMContentLoaded event listener. Here's an example of how you might modify the code:

document.addEventListener('DOMContentLoaded', (event) => {
    // Your initialization code here
    interact('.draggable-canvas').draggable({
        // draggable options
    });
});

This ensures that the draggableElement is only initialized after the DOM elements are available, preventing the null error. Make sure this change is applied in the draggable.js file where the draggableElement is being initialized.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Ludy87 Ludy87 added the Front End Issues or pull requests related to front-end development label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Front End Issues or pull requests related to front-end development Priority: Medium Issues or pull requests with medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant