Hello everyone, I have a problem capturing the "escape" event for a modal dialog page.
First, as read on the forum, I put my "close" in the dialog attributes like this:
close: function (event, ui) {sepaq.dialogCloseEvent (event, ui, {dialogPageId: '& APP_PAGE_ID.'});
My fonction:
sepaq.dialogCloseEvent = function (event, ui, dialogPageId) {
const escape = 'Escape'
const type = ($(event).attr('originalEvent')) ? event.originalEvent.type : ''
apex.debug.info('dialogCloseEvent %s', dialogPageId)
apex.debug.info($(event).attr('originalEvent'))
switch (type) {
case 'click':
apex.navigation.dialog.close(true, dialogPageId)
break
case 'keydown':
let keypress = $(event.originalEvent.originalEvent).attr('key')
if (keypress === escape) {
apex.navigation.dialog.close(true, dialogPageId)
}
break
default:
break
}
}
On my parent page I must always receive the event closedialog .... not cancel.
To capture the closure of the dialog with the X icon, there is no problem. the event.originalEvent.type is "click"
But I am unable to catch the "escape" tab event that closes the dialog ... my code does not work.
($ (event) .attr ('originalEvent')) is always undefined.
Can anyone help ?