I would like to have an alert notification appear that the user is unable to remove by clicking the shadow or using the escape key.
Perhaps named something like 'fatal-error'
My particular need is for a system inactivity plugin - where after X seconds of inactivity I close their session and display a notification informing the user they must close the window and restart their session.
The current notify options do not offer me this functionality.
isCancellable?
I think perhaps "isModal" might be better? This is what I've always called this type of dialog box, i.e. "A modal dialog is a window that forces the user to interact with it before they can go back to using the parent application." https://ux.stackexchange.com/questions/12045/what-is-a-modal-dialog-window
So if isModal is true the following 2 properties would be set to false:
allowEscapeKey
allowOutsideClick
It is always a modal @ian-dowhile just Paul wants to force the user to choose from the prompt buttons ( which would force the callback functions to fire) or no buttons (to leave the user there), rather than close action. You can already use "prompt" or "alert" type to get rid of the close button, only "popup" has a close button. https://github.com/adaptlearning/adapt_framework/blob/master/src/core/templates/notify.hbs#L43
I think allowEscapeKey and allowOutsideClick is too granular.
Essentially the close button, the outside click and the escape key all do the same thing - the close action. If you allow one but not the other, that's a bit pointless. We need to have a way of blocking the close action.
https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/views/notifyView.js#L92
if (!this.model.get("_allowClose")) return;
https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/models/notifyModel.js#L5
_allowClose: true
?
I suggested isCancellable because the event that fires on close is currently called "notify:cancelled"
https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/views/notifyView.js#L94
Yes that is correct @oliverfoster - I want to have the option to display a "modal" where the user is unable to close it by using the outside click or the escape key. I can already select one of the options that does not include a close button.
Having the ability to prevent the user using escape or the outside click on all of the modal types sounds like a more flexible solution as even with the "modal" with a close button a client may not wish the user to be able to close it by clicking on the shadow or using the escape key.
My only counter at this point is: If you have a client that has repeatedly requested this feature on numerous projects and it's becoming a real bugbear to keep modifying the core, then I can understand the implementation of the granular options. If we're just implementing it because it'd be nice then I'm totally not on board.
I can see the validity in having an undismissable modal. We have used an undismissable modal a few times on various projects for various clients, and I think maybe the shadow dismiss and escape functionality being permanently on is an oversight for a previously covered use-case.
I would be for disabling shadow and escape dismiss on the alert and popup types where the template shows no close button, or allowing the optional disabling of that behaviour on all types. That is unless allowEscapeKey and allowOutsideClick must be implemented to save you production time.
I don't think we've ever had a client want to turn off that behaviour in such granularity. We have had clients who wanted to have the escape and shadow behaviour as these things are standard web/application interactions.
Thanks @oliverfoster - an undismissable modal is really all that I require. Anything else is as you say just "nice"
Cool 馃憤
An undismissable modal could be very useful for #1333
I would be for disabling shadow and escape dismiss on the alert and popup types where the template shows no close button, or allowing the optional disabling of that behaviour on all types.
I'd actually vote for both of those scenarios. Displaying a Notify with no buttons seems to me to imply that you should not be able to close the Notify by any means. But I can also see some value in being able to have just one (action) button - in the example of #1333 I'd probably want to include a 'Show debug log' button in there.
i've added _isCancellable in this pr as a new property of the alertObject
done in 0067696c34024616f79b94523e6d19bd8d61b1bf
Thanks guys - much appreciated!
Most helpful comment
It is always a modal @ian-dowhile just Paul wants to force the user to choose from the prompt buttons ( which would force the callback functions to fire) or no buttons (to leave the user there), rather than close action. You can already use "prompt" or "alert" type to get rid of the close button, only "popup" has a close button. https://github.com/adaptlearning/adapt_framework/blob/master/src/core/templates/notify.hbs#L43
I think allowEscapeKey and allowOutsideClick is too granular.
Essentially the close button, the outside click and the escape key all do the same thing - the close action. If you allow one but not the other, that's a bit pointless. We need to have a way of blocking the close action.
https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/views/notifyView.js#L92
https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/models/notifyModel.js#L5
?
I suggested isCancellable because the event that fires on close is currently called "notify:cancelled"
https://github.com/adaptlearning/adapt_framework/blob/master/src/core/js/views/notifyView.js#L94