notiflix / Notiflix

Notiflix is a pure JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.

Home Page:https://notiflix.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] - call confirm after prompt

injaan opened this issue · comments

Describe the bug

I called confirm window after successful prompt action but confirm not called, nothing happened

To Reproduce

call confirm after prompt

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows, macOS...]
  • Browser [e.g. Chrome, Edge, Firefox, Safari...]
  • Version [e.g. v3.0.0]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. v3.0.0]

Additional context

Add any other context about the problem here.

Hi @injaan

Can you please share your snippet to see what is happening?


In addition:
You need to be sure that the previous Confirm method should be removed(there is a CSS animation delay(of 300 milliseconds), so it is not removed immediately) from DOM.

The Confirm module is allowing to show only one confirmation at the same time. This means you will not get the second one if you are calling the second one before the previous one is completely removed.

Hi @furcan thank you for answered for my problem
I tried following

Confirm.prompt(
    'Are you sure',
    'Please enter number!',
    '10',
    'Continue',
    'Cancel',
    (value) => {
        if(value){
            Confirm.show(
                'Confirm',
                `Your chosen number is ${value} are you sure to continue?`,
                'Yes',
                'No',
                () => {
                  console.log("confirmed", value);
                }
              );
        }
    }
);

So is it really not possible to call 'Confirm' right after 'Prompt'? I think call confirm after prompt would be really useful if it is implemented.

Hi @injaan

This is your solution.

Thanks.

var delay = 300; // the default value

Confirm.prompt(
  "Are you sure",
  "Please enter number!",
  "10",
  "Continue",
  "Cancel",
  (value) => {
    if (value) {
      var wait = setTimeout(function () {
        Confirm.show(
          "Confirm",
          `Your chosen number is ${value} are you sure to continue?`,
          "Yes",
          "No",
          () => {
            console.log("confirmed", value);
          }
        );
        clearTimeout(wait);
      }, delay + 1);
    }
  },
  undefined,
  {
    cssAnimationDuration: delay,
  },
);

@furcan thank you

You are welcome 🙏