Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preact with v2 : Uncaught TypeError: Cannot read property 'scrollTop' of null

See original GitHub issue

Hi there,

First of : great project and awesome work. I’ve been using it for quite some time now in multiple projects, and rarely had any problem. Now I’m testing the v2 with my Preact project and finding some weird behaviour / errors. The component works as expected, most of the time, but when I select a value and scroll again in the dropdown menu, the error “Uncaught TypeError: Cannot read property ‘scrollTop’ of null” gets spammed in the console.

I’d love to add a plunker to reproduce, but its quite a pain to get it to work with preact and react select dependencies, right in the live html page…

Also I know it’s in Preact not and directly React, I’ve used this lib in preact before and didnt have any trouble. Plus, Preact is being used more and more so I figured it might be worth reporting as it seems to be linked to the use of refs with a particular syntax. My usage is very basic, so it does not seem to be an issue related to some exotic config of the component :

            option: (styles, {data, isSelected, isFocused}) => {
              return ({
                backgroundColor: (isSelected || isFocused) ? '#EEE' : '#FFF',
                color: '#444',
                textAlign: 'left'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

webschikcommented, Jan 14, 2019

I have the same problem, as a temporary fix I use the next solution:

// webpack.config.js
    test: /react-select\/dist\/react-select.esm.js/,
    exclude: [],
    loader: path.resolve('dev-tools/webpack/loaders/react-select-loader.js') //  your custom loader
// dev-tools/webpack/loaders/react-select-loader.js

// quick fix for
module.exports = function reactSelectLoader (source) {
    return source
        .replace(' _this$scrollTarget = _this.scrollTarget,', ' _this$scrollTarget = event.currentTarget,')
        .replace(' target = _this.scrollTarget;', ' target = event.currentTarget;');
HadrienPierartcommented, Jul 11, 2018

It’s been more than a month, the issue is still present in the .7 of the beta. Any idea ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Material Ui (v5) Drawer - Cannot read property ...
TypeError : Cannot read property 'scrollTop' of null at reflow (node_modules\@mui\material\node\transitions\utils.js:9:29) at ...
Read more >
Uncaught TypeError: Cannot read property 'scrollTop' of null
So, in Eureka , this code works fine: function close_and_reopen_UI_Page() { // Close this current pop-up UI page ...
Read more >
Uncaught TypeError: cannot read property scrollTop of null
In function _2aF() at jquery.easyui.min.js:3893, the property scrollTop is accessed to calculate the style bottom :.
Read more >
747 kB - Hugging Face
ll ; , final ize b ing ctrl Key parse JSON By ID m en Prefilter s Ġcon nection Ġimplement ed E xis...
Read more >
Demo - TreeView Accordion - JSFiddle - Code Playground
2. ​. 3. // create a list of items with header and detail properties ... scrollTop+e.offsetHeight>=e. ... _dd!=null},set:function(i){var f,u,e;if(i!=this.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found