Skip to content

Fix Datepicker TypeError crash by clearing pending hide timeout on dispose - #43254

Open
ShakilUrRehman21 wants to merge 1 commit into
twbs:mainfrom
ShakilUrRehman21:fix/datepicker-clear-hide-timeout-on-dispose
Open

ShakilUrRehman21 wants to merge 1 commit into
twbs:mainfrom
ShakilUrRehman21:fix/datepicker-clear-hide-timeout-on-dispose

Conversation

@ShakilUrRehman21

Copy link
Copy Markdown
Contributor

Description

When selecting a date in single or multiple-ranged mode, _maybeHideAfterSelection queues setTimeout(() => this.hide(), HIDE_DELAY).

If dispose() was called within the 300ms delay, the timer executed this.hide() on the disposed instance (this._config === null), throwing TypeError: Cannot read properties of null (reading 'inline').

Changes

  • Store the timeout ID in this._hideTimeout.
  • In dispose(), clear this._hideTimeout.
  • In hide(), clear this._hideTimeout and add a defensive check before reading this._config.
  • Add unit test verifying dispose() clears the pending hide timer without throwing.

@ShakilUrRehman21
ShakilUrRehman21 requested a review from a team as a code owner October 31, 2026 12:32
@julien-deramond julien-deramond added v6 v6, the main branch bug Something does not work as documented js JavaScript or TypeScript sources and plugins labels Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something does not work as documented js JavaScript or TypeScript sources and plugins v6 v6, the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants