*/
class OpenOffCanvasDialogCommand extends OpenDialogCommand {
+ /**
+ * The dialog width to use if none is provided.
+ */
+ const DEFAULT_DIALOG_WIDTH = 300;
+
/**
* Constructs an OpenOffCanvasDialogCommand object.
*
// @todo drupal.ajax.js does not respect drupalAutoButtons properly, pass an
// empty set of buttons until https://www.drupal.org/node/2793343 is in.
$this->dialogOptions['buttons'] = [];
+ // If no width option is provided then use the default width to avoid the
+ // dialog staying at the width of the previous instance when opened
+ // more than once, with different widths, on a single page.
+ if (!isset($this->dialogOptions['width'])) {
+ $this->dialogOptions['width'] = static::DEFAULT_DIALOG_WIDTH;
+ }
}
/**