【Bug】Uncaught TypeError: Cannot read property 'element' of null
See original GitHub issueGithub link
https://github.com/djkloop/vuedraggable-issuse-error.git
Step by step scenario
# Uncaught TypeError: Cannot read property 'element' of null
Actual Solution
# Dragging is normal for the first time, and an error will be reported when dragging back to the original position
Expected Solution
# Can't drag
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >Uncaught TypeError: Cannot read property 'value' of null
getElementById can't find an element with the supplied ID, it returns null. So the error is telling you it can't find one of...
Read more >Solve - Cannot read property 'click' of Null in JavaScript
The "Cannot read property 'click' of null" error occurs when trying to call the click method on a null value. To solve the...
Read more >How to deal with TypeError: cannot read properties of null
While coding in Javascript, you must have at least once received a Type Error which has the message “cannot read properties of null”....
Read more >Uncaught TypeError Cannot read property value of null
Uncaught TypeError Cannot read property value of null ... $(document).ready(function(){ var str = document.getElementById("cal_preview").value; ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I flipped it around and used
tag="div" :component-data="{ as: 'transition-group' }"
and it worked better.Might not apply here since I’m on Vue 3.2 and Vue.Draggable.Next v4.1, but this thread did give the answers as to stuff about the fatherNode error, so I feel it’s at least worth punting here for the next person. If anyone wants to confirm it in the Vue 2 version, be my guest, I don’t have a Vue 2 app handy.
I had the same issue when dragging between two lists if I use
tag="transition-group"
(but not when I use the defaulttag="div"
). The error indicated that inserting the node failed, something aboutfatherNode
being a text node (so it couldn’t access children).I fixed it by using
tag="transition-group" :component-data="{ tag: 'div' }"
to cause<transition-group>
to output an actual DOM element.