When the popup is displayed, the background content still remains scrollable. We could provide the user with a setting option, whether to allow or disable background scrolling. Because when the popup stands in the front, it does not feel to be a good UX to scroll through the background content when they are only partially visible.

Comments

jamesashok created an issue. See original summary.

jamesashok’s picture

StatusFileSize
new4.21 KB

The following patch updates a 'Prevent background scrolling' setting to all popups as a checkbox.

  • Option enabled: scrolling is disabled when popup is open.
  • Option disabled: default scrolling behaviour will be applied.
jamesashok’s picture

Assigned: jamesashok » Unassigned
Status: Active » Needs review
dewalt’s picture

Status: Needs review » Closed (works as designed)

Hi jamesashok,

I've investigated the issue. I don't see any needs to configure background scrolling individual per pop-up - in the most cases the same behavior for all pop-ups on the site is used.

The feature could be added to module global settings, but it is not the module area to change global dialog settings for the site. (The module don't define own popup functionality, it uses Drupal.dialog API)

It could be done with separate module or on the theme level. For example `Bootstrap` theme overrides Drupal.dialog, and background is not scrolled as in Bootstrap dialog.

The same could be implemented for all site dialog adding to theme JS the next code:

  $(window).on({
    'dialog:aftercreate': function (event, dialog, $element, settings) {
      $('body').css('overflow', 'hidden');
    },
    'dialog:beforeclose': function (event, dialog, $element) {
      $('body').css('overflow', '');
    }
  });

I admit that it functionality in this module scope could be useful from site building perspective, using contrib theme and having ability to add own JS snippet, but as I said before it is not the module area - I should investigate if other modules/themes allows it.

If no modules implement it - it is good idea for starting some new "Drupal UI tweaks" module.