mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 02:59:07 +08:00
In rare cases, especially on mobile, we could end up in a situation
where `null` is given to `unlockScroll`, we were given a default arg to
the function through: `unlockScroll(element =
document.scrollingElement)` but this is working only if the given
element is `undefined` and not `null` resulting sometimes in the
following error:
```js
TypeError: null is not an object (evaluating 'element.classList')
```
Following this error, the whole UI would become unresponsive.
Here is a simple example to demonstrate the buggy behavior here:
```js
function greet(name = "World") {
console.log(`Hello, ${name}!`);
}
greet(); // Hello, World! ✓ (default applied)
greet(undefined); // Hello, World! ✓ (default applied)
greet(null); // Hello, null! ✗ (default NOT applied!)
```
|
||
|---|---|---|
| .. | ||
| asset-processor | ||
| custom-proxy | ||
| deprecation-silencer | ||
| discourse | ||
| discourse-i18n | ||
| discourse-markdown-it | ||
| discourse-plugins | ||
| discourse-types | ||
| discourse-widget-hbs | ||
| ember-cli-progress-ci | ||
| pretty-text | ||
| .npmrc | ||
| polyfills.js | ||