Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal UI: clickableOverlay option doesn't work #7399

Closed
thdoan opened this issue Nov 11, 2016 · 24 comments
Closed

Modal UI: clickableOverlay option doesn't work #7399

thdoan opened this issue Nov 11, 2016 · 24 comments
Assignees
Labels
bug report Component: Cms Event: distributed-cd Distributed Contribution Day Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@thdoan
Copy link

thdoan commented Nov 11, 2016

Preconditions

  1. Magento 2.1.2

Steps to reproduce

  1. Go into any template and create a modal widget with this code:
require(['Magento_Ui/js/modal/modal'], function(modal) {
  $('#some-element').click(function(e) {
    e.preventDefault();
    $('<p>Overlay content</p>').modal().modal('openModal');
  });
});
  1. Click on $('#some-element') to show the overlay.
  2. Click on the overlay (shadow).

Expected result

  1. According to the documentation, the default clickableOverlay value is true, which means "Close the modal window when a user clicks on the overlay".

Actual result

  1. Nothing happens (i.e., the overlay does not close). Even when you manually specify the option, it doesn't work:

$('<p>Overlay content</p>').modal({ clickableOverlay: true }).modal('openModal');

@BB-000
Copy link

BB-000 commented Nov 18, 2016

+1 , The z-index of the popup is higher than the .modals-overlay, but the popup wrapper

covers the whole screen area, making the overlay unclickable.

Increasing the z-index of the .modals-overlay makes the click-to-close work, but the popup is then put behind whatever the background colour of the .modals-overlay is . . .

@erikhansen
Copy link
Contributor

I've encountered this issue on multiple projects.

@erikhansen
Copy link
Contributor

erikhansen commented Jan 7, 2017

We created a workaround for this issue in a custom theme using a RequireJS mixin by adding the following files:

app/design/frontend/<VENDOR>/<THEME>/Magento_Ui/web/js/model/modal-mixin.js

define([
    'jquery',
    'mage/utils/wrapper'
], function ($, wrapper) {
    'use strict';

    return function (modal) {

        modal.prototype.openModal = wrapper.wrap(modal.prototype.openModal, function(original) {

            var result = original();
            $('.' + this.options.overlayClass).appendTo('.modal-popup._show');
            //Setting z-index of inner-wrap to 900 so that it is actually clickable and not hiding behind the overlay
            $('.modal-inner-wrap').css('z-index', 900);
            return result;
        });

        return modal;
    };
});

app/design/frontend/<VENDOR>/<THEME>/requirejs-config.js

var config = {
    config: {
        mixins: {
            'Magento_Ui/js/modal/modal': {
                'Magento_Ui/js/model/modal-mixin': true
            }
        }
    }
};

See this great article by Alan Storm for info on M2's RequireJS Mixins: http://alanstorm.com/the-curious-case-of-magento-2-mixins/

@miakusha
Copy link
Contributor

miakusha commented Jan 20, 2017

Hi @thdoan thanks for report
We've created internal ticket MAGETWO-63410 to address this issue.

@miakusha miakusha added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jan 20, 2017
@BB-000
Copy link

BB-000 commented May 18, 2017

@erikhansen Unfortunately for me that fix works on desktop (popup) but breaks mobile (slide) modals...

@erikhansen
Copy link
Contributor

@BB-000 Yeah, we discovered some issues with the code I posted previously and have since refactored and moved the code into a standalone extension called ClassyLlama_ModalEnhancements. I've attached it to this comment. Use at your own risk.

ClassyLlama_ModalEnhancements.zip

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Cms Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@nntoan
Copy link
Contributor

nntoan commented Oct 9, 2017

@erikhansen It's working. Please create a PR :)

@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 2.2.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 19, 2017
@magento-engcom-team
Copy link
Contributor

@thdoan, thank you for your report.
We've created internal ticket(s) MAGETWO-63410 to track progress on the issue.

@magento-engcom-team
Copy link
Contributor

Hi @thdoan. Thank you for your report.
The issue has been fixed in #15172 by @virtua-pmakowski in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

@shibinvr
Copy link

hi when upgrade with ClassyLlama_ModalEnhancements.zip module but still modal not close when click overlay. any idea why

@sidolov
Copy link
Contributor

sidolov commented Jul 11, 2018

Hi @thdoan. Thank you for your report.
The issue has been fixed in #16665 by @mageprince in 2.1-develop branch
Related commit(s):

The fix will be available with the upcoming 2.1.15 release.

@sidolov sidolov added Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line labels Jul 11, 2018
@sidolov
Copy link
Contributor

sidolov commented Jul 11, 2018

Hi @thdoan. Thank you for your report.
The issue has been fixed in #16664 by @mageprince in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@hamdrew
Copy link

hamdrew commented Jul 11, 2018

I do not see this fix in the Magento 2.2.5 release

@BB-000
Copy link

BB-000 commented Aug 8, 2019

.modal-popup { pointer-events: none; }

@zaximus84
Copy link

This is not fixed in 2.2. The CSS for pointer-events is present, but modal.js doesn't actually handle a click on the overlay. clickableOverlay is present in the default options, but it's not found anywhere else in the file (meaning it's not used). Comparing 2.1, 2.2, and 2.3, the _createOverlay method is lacking lines in 2.2.

@zaximus84 zaximus84 reopened this Aug 14, 2019
@ghost ghost unassigned alpacode-pmakowski Aug 14, 2019
@ghost ghost removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed good first issue Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Aug 14, 2019
@engcom-Charlie engcom-Charlie self-assigned this Aug 15, 2019
@m2-assistant
Copy link

m2-assistant bot commented Aug 15, 2019

Hi @engcom-Charlie. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie
Copy link
Contributor

Hello @zaximus84
Branch 2.2-develop was closed and Magento no longer accepts pull requests and issues to the v2.2 release lines to focus all development efforts on v2.3._
See Accepted pull requests and ported code for more details
So i close this issue.

@LiamKarlMitchell
Copy link

Still a problem in Magento 2.3.0

@sarkadiadam
Copy link

sarkadiadam commented Nov 9, 2020

Hello, made it work by applying a small css fix (if anyone is still interested):

.modal-popup {
    pointer-events: none;
    touch-action: none;
}

magento-devops-reposync-svc pushed a commit that referenced this issue Apr 12, 2022
ACP2E-120: Magento_Fedex Package description and handling fee issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Cms Event: distributed-cd Distributed Contribution Day Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests