Problem/Motivation
In
π¬
Additional modal support
Active
, to improve a proper support of Drupal dialog in Bootstrap, @tocab found out that the modal in the Node module which prevents leaving the node preview page is not using properly the Drupal dialog API.
So an override is not taken into account.
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/node/...
Drupal.dialog($previewDialog, {
...
click() {
$(this).dialog('close');
},
},
...
This is not using the dialog API, while other JS code in Core is implemented differently. Like in https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/edito...
const confirmationDialog = Drupal.dialog(`<div>${message}</div>`, {
...
buttons: [
{
text: Drupal.t('Continue'),
class: 'button button--primary',
click() {
changeTextEditor(field, newFormatID);
confirmationDialog.close();
},
},
...
});
confirmationDialog.showModal();
using the "close" method on the instance of the dialog object.
Steps to reproduce
Proposed resolution
Update node.preview.js to use the same approach.
const confirmationDialog = Drupal.dialog($previewDialog, {
title: Drupal.t('Leave preview?'),
buttons: [
{
text: Drupal.t('Cancel'),
click() {
confirmationDialog.close();
},
},
{
text: Drupal.t('Leave preview'),
click() {
window.top.location.href = event.currentTarget.href;
},
},
],
});
confirmationDialog.showModal();
Remaining tasks
I will let @tocab create the MR as he is the one which found the issue and solution. I have only tested the solution.
- create a MR
- code review
User interface changes
None