Bug with webix.confirm and type 'alert-warning'

When I create confirm with type:"alert-warning" then dialog always goes to then promise result either user clicks on ok or cancel buttons.

webix.confirm({
  text: 'You are about to leave editing and you have unsaved changes. What do you want to do?',
  ok: 'Discard changes',
  cancel: 'Back to editing',
  width: 400,
  type: 'alert-warning'
}).then(
  () => { /* We got here in any way, by ok or cancel. */ }
);

webix pro 11.3.

Hello @russell ,

You’re using type: "alert-warning" inside webix.confirm() , but alert- types are designed for webix.alert(): a dialog with only an ok button. When you force an alert type into a confirm, the dialog still shows two buttons (because webix.confirm always creates ok/cancel), but the promise does not reject when cancel is clicked, it always resolves. That’s why your .then() runs every time and .fail() is never triggered.

The correct type for a confirm dialog is "confirm-warning" (or "confirm-error" ). With this type, the promise resolves on ok and rejects on cancel , exactly as the documentation describes.

Please check the example: Code Snippet

1 Like

Thank you. It works.