Backdrop, keyboard and focus settings support

Created on 28 November 2023, about 1 year ago
Updated 25 January 2024, 11 months ago

Problem/Motivation

It seems that there is no option through HTML attribute to configure the Bootstrap settings such as backdrop, keyboard and focus. The additional options are particularly useful, especially when the modal content is a form. The keyboard option can prevent unintended closure of the modal unless the close button is clicked.

Proposed resolution

To add new settings for backdrop, keyboard and focus in data-dialog-options.

{% set
    defaultOptions = {
      autoOpen: 'true',
      dialogClasses: '',
      dialogShowHeader: 'true',
      dialogShowHeaderTitle: 'true',
      buttonClass: 'btn',
      buttonPrimaryClass: 'btn-primary',

      keyboard: 'true',
      focus: 'true',
      backdrop: 'static',
    }
%}
<a href="/" class="use-ajax" data-dialog-type="bootstrap4_modal" data-dialog-options="{{ defaultOptions|json_encode }}">Open in Bootstrap Modal</a>
πŸ’¬ Support request
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡΅πŸ‡­Philippines madelyncruz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024