fix(form-core): don't remove event listeners if _focusableNode was not set
This fix is similar to the previous commit. Under very specific circumstances on a very complicated application logic, a file input field (that extends from FocusMixin) gets created and immediately destroyed. This unfortunately causes an error, because the `disconnectedCallback()` gets called to remove the event listeners for a component that hasn't been fully set up. > Uncaught TypeError: this._focusableNode is null
This commit is contained in:
parent
ef7f16a51c
commit
1d3a00c022
1 changed files with 1 additions and 0 deletions
|
|
@ -198,6 +198,7 @@ const FocusMixinImplementation = superclass =>
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
__teardownEventsForFocusMixin() {
|
__teardownEventsForFocusMixin() {
|
||||||
|
if (!this._focusableNode) return;
|
||||||
this._focusableNode?.removeEventListener(
|
this._focusableNode?.removeEventListener(
|
||||||
'focus',
|
'focus',
|
||||||
/** @type {EventListenerOrEventListenerObject} */ (this.__redispatchFocus),
|
/** @type {EventListenerOrEventListenerObject} */ (this.__redispatchFocus),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue