airbnb / rheostat

Rheostat is a www, mobile, and accessible slider component built with React
MIT License
1.69k stars 189 forks source link

[Slider] Fix "TypeError: Cannot read 'getBoundingClientRect' of null" #271

Closed noratarano closed 4 years ago

noratarano commented 4 years ago

I couldn't repro this error, but I think this should fix it.

TypeError: null is not an object (evaluating 'this.handleContainerNode.getBoundingClientRect')
  at getSliderBoundingBox (./node_modules/rheostat/lib/Slider.js:325)
  at None ([native code])
  at touch (./node_modules/rheostat/lib/Slider.js:704)
  at None ([native code])
  at this (./node_modules/rheostat/lib/Slider.js:677)
...
(2 additional frame(s) were not displayed)

By protecting access to this.handleContainerNode, we avoid this issue completely.

@ljharb @lencioni

Airbnb internal ticket: PRODUCT-49741