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

fix: #13571 | Multiselect not repositioned #13587

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

guillaume-tritsch
Copy link

fix: #13571

Explanation

The code for MultiSelect and Dropdown components closely resembles each other. However, I observed that the bug was occurring exclusively in the MultiSelect component. Upon comparing their respective code, I identified that a particular section of the MultiSelect code was never executed due to the constant state of the filtered variable being set to false. To address this issue, I introduced a code modification that ensures filtered is set to 'true' whenever the onFilterInputChange method is invoked.

In code

onFilterInputChange(event: KeyboardEvent) {
    this._filterValue = (<HTMLInputElement>event.target).value;
    this.activateFilter();
    this.filtered = true; // I add this line
    this.onFilter.emit({ originalEvent: event, filter: this._filterValue });
    this.cd.detectChanges();
}

this.cd.detectChanges() refresh the view and call ngAfterViewChecked but filtered attribut is on false, so the alignOverlay is never call.

ngAfterViewChecked() {
    if (this.filtered) {
        this.zone.runOutsideAngular(() => {
            setTimeout(() => {
                this.overlayViewChild?.alignOverlay();
            }, 1);
        });
        this.filtered = false;
    }
}

I hope my explanations are clear, and I haven't made any mistakes when reading the code.

@vercel
Copy link

vercel bot commented Aug 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primeng ⬜️ Ignored (Inspect) Visit Preview Aug 31, 2023 8:50am

@gucal gucal self-requested a review August 31, 2023 10:49
@gucal gucal added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Aug 31, 2023
Copy link
Contributor

@cetincakiroglu cetincakiroglu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @guillaume-tritsch ,

Thanks for the effort and support!

@cetincakiroglu cetincakiroglu merged commit 6696ceb into primefaces:master Sep 21, 2023
@cetincakiroglu cetincakiroglu removed the Status: Pending Review Issue or pull request is being reviewed by Core Team label Sep 21, 2023
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

Successfully merging this pull request may close these issues.

MultiSelect: Overlay not repositioned after filtering options
3 participants