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

16.3.1 regression: p-overlayPanel dismisses when making changes to nested p-multiSelect with appendTo="body" #14120

Closed
NateRadebaugh opened this issue Nov 15, 2023 · 5 comments · Fixed by #13810
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@NateRadebaugh
Copy link

Describe the bug

I have a p-multiSelect with appendTo="body" inside of p-overlayPanel.

When the user toggles selection of a p-multiSelect, the p-overlayPanel dismisses.

This is a regression that started when I upgraded from 16.1.x to 16.3.1 and is still present in [email protected]

I've found that this reproduces when I use appendTo="body" on the p-multiSelect inside of the p-overlayPanel since the updated code in p-overlayPanel considers it a "click away" even though the actual component is within the overlay.

Related: #13601

Environment

browser

Reproducer

https://stackblitz.com/edit/stackblitz-starters-hzx9fv?file=src%2Fmain.component.html

Angular version

16.2

PrimeNG version

16.4.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v18.17,.1

Browser(s)

Chrome

Steps to reproduce the behavior

Open overlay panel
Open multiselect
Choose an item
Overlay panel closes automatically!

Expected behavior

Overlay panel should stay open until I click away or programatically close it.

@erber014
Copy link

Can confirm this issue, this happens with more components than just the p-multiSelect, for example the calendar component. A previous issue similar to this exists here: #13950

@NateRadebaugh
Copy link
Author

NateRadebaugh commented Nov 30, 2023

For now, I disabled the dismissable feature and manually handle dismissing the panel for now since otherwise this had me stuck on primeng@~16.1.0.

This workaround isn't ideal but got me moving forward to the latest primeng:

<p-overlayPanel
  #overlayPanel
  [dismissable]="false"
>
    <!-- ... -->
    <button type="text" (click)="overlaypanel.hide()">Cancel</button>
</p-overlaypanel>

@simoneraffaelli
Copy link

I ended up making another workaround, if someone is interested: #14323 (comment)

@cetincakiroglu cetincakiroglu added this to the 17.1.0 milestone Dec 13, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 13, 2023
cetincakiroglu added a commit that referenced this issue Dec 13, 2023
…cting-dopdown-option

OverlayPanel: Fix regression #14120 detect click on scrollbar, prevent hiding when selecting dropdown options
@simoneraffaelli
Copy link

simoneraffaelli commented Dec 14, 2023

as stated here: #14323

This problem is still present if you click the clear icon on the dropdown or if you uncheck the combobox

@padefi
Copy link

padefi commented Jul 1, 2024

Hi guys!
Hope you're well.

I solved this issue by adding some parameters to the OverlayPanel and adding a div.

Here's my code (PrimeVue)

const allowHide = ref(true);

const handleHide = (event) => {
    if (!allowHide.value) {
        allowHide.value = true;
    }
};

// Handling clicks inside the OverlayPanel
const onContentMouseDown = () => {
    allowHide.value = false;
};

<OverlayPanel ref="expensesPanel" appendTo="body" :dismissable="false" @hide="handleHide">
 <div @mousedown.stop="onContentMouseDown">
   <DataTable v-model:filters="expensesFilters" :value="voucherExpensesArray" paginator :rows="5" dataKey="id" filterDisplay="row" :globalFilterFields="['name']">
   ....
  </DataTable>
  </div>
</OverlayPanel>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
5 participants