primeng icon indicating copy to clipboard operation
primeng copied to clipboard

ConfirmDialog on close should NOT act as reject - Reverse of #921

Open QuentinLeGoff opened this issue 9 years ago • 7 comments

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior Since 4.1.0 and #921 , when escape button of confirm dialog is clicked, the reject method of reject button is invocked.

Expected behavior I think the escape button and the reject button should not have the same behavior because:

  • click on the 'No' button means reject the action
  • however escape the dialog means go back to the previous state

So the escape button should not start the reject method. No ? At least, the close event can be exposed to invoked a method.

Minimal reproduction of the problem with instructions

https://www.primefaces.org/primeng/#/confirmdialog

  • PrimeNG version: 4.1.0

QuentinLeGoff avatar Jul 18 '17 11:07 QuentinLeGoff

General and popular feedback was rejecting it on close, if more users demand not rejecting it, we'll introduce an attribute to make this customizable.

cagataycivici avatar Jul 18 '17 12:07 cagataycivici

Okay, I understand. Is there a way to detect if it's a close event from the cross click or from the no button in the reject method ?

QuentinLeGoff avatar Jul 19 '17 12:07 QuentinLeGoff

i have the same question, is there a way to detect the close event? we would like to handle close and reject event separately.

shijusn avatar Jul 31 '17 04:07 shijusn

I agree, this should be parametrized.

karolgebert avatar Nov 28 '17 09:11 karolgebert

Any update to make a reject option as parameterized to differentiate between close and reject ?

comlabmohan avatar May 28 '18 09:05 comlabmohan

Close button should only close the dialog. And the rejection button that must be an action.

pedrotcm avatar Aug 25 '18 22:08 pedrotcm

You can differentiate between closing and rejecting in the reject callback function:

reject: (button: number) => {
          if (button === 2) {
          // handle close
            return;
          }
          // handle reject
        },

As far as I could tell this is not documented anywhere.

vanhaalen avatar May 16 '24 08:05 vanhaalen