Clobbering of `ref` when using TouchScrollable
See original GitHub issueI was recently building a modal and using ScrollLock and I inadvertently introduced a bug that cost me 30 minutes or so simply by wrapping a div
that had a critical ref
in a ScrollLock
component. It turns out that TouchScrollable
clobbers the ref
prop:
There are workarounds for this (like using React.forwardRef
), but at the very least this behavior should be documented.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
DOM clobbering | Web Security Academy - PortSwigger
In this section, we will describe what DOM clobbering is, demonstrate how you can exploit DOM vulnerabilities using clobbering techniques, and suggest ways ......
Read more >React Render Method Clobbering - Stack Overflow
To test this theory I wrapped this.props.onChange(value); in a setTimeout . Even with a time of 0 , the issue seems to have...
Read more >DOM Clobbering — It's clobbering time!!! - Medium
DOM Clobbering is a technique in which we inject HTML in a page to ... Now the testObject reference is overwritten with this...
Read more >Untitled
Jewelry made with polymer clay, Mix kiss sound 2014, Epicoccum species ... the appalachian trail, Easy refrigerator slice recipe, The quest 2 van...
Read more >Dom Clobbering - HackTricks
... you can clobber the someObject reference with a DOM node, such as an anchor. ... to overwrite attributes of the document object...
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 FreeTop 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
Top GitHub Comments
Right, but why not use applyRef internally to avoid the confusion? In any case, this ought to be documented.
@wojciech-skowronek I didn’t modify the library to make it work; I just wrapped the children in an extra
div
like so:This extra
div
will give TouchScrollable something to add its ref to without affectingsomeRef
that I care about. This won’t work in all situations, unfortunately (depends on your DOM tree).