Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker in dropdown closes both on date selection #6736

Open
HannaKukharava opened this issue Mar 19, 2025 · 0 comments
Open

Datepicker in dropdown closes both on date selection #6736

HannaKukharava opened this issue Mar 19, 2025 · 0 comments

Comments

@HannaKukharava
Copy link

HannaKukharava commented Mar 19, 2025

When using the datepicker inside a dropdown, selecting a date closes not only the datepicker but also the dropdown.
This issue started occurring since ngx-bootstrap v18.0.2 after the changes introduced in this fix, specifically after adding the following line of code:

this._componentRef?.destroy();

For some reason, this change emits a click event, which triggers the toggle click with false as its value. As a result, the hide() method in BsDropdownDirective is called, causing the dropdown to close unexpectedly.
Relevant call stack and behavior:

this._state.toggleClick.emit(false);

Reproduction
You can reproduce the issue in the following StackBlitz Example

Versions of ngx-bootstrap, Angular, and Bootstrap:

  • ngx-bootstrap: v18.0.2+ (bug introduced in v18.0.2. StackBlitz Example is v19.0.2)
  • Angular: v19.0.6
  • Bootstrap: v5.3.3

Expected Behavior
Selecting a date in the datepicker should only close the datepicker while keeping the dropdown open.

Actual behaviour:
Selecting a date in the datepicker closes datepicker and dropdown.

Additional Context
This behavior was not present in versions prior to v18.0.2 and appears to be a regression due to the linked PR.
Would appreciate any insights or potential workarounds in the meantime. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant