Giter VIP home page Giter VIP logo

rmodal.js's People

Contributors

alexheb avatar emilhem avatar imrefazekas avatar sanjuroo avatar zewish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rmodal.js's Issues

Using <dialog> as base

Have you considered using the standard <dialog> element as a base? It is already supported in Blink-based browsers.

Content may be hidden because modals have a fixed width

Hi, I recently went from Bootstrap modals to rmodal because I didn’t like Bootstrap’s bloated CSS, and I like rmodal a lot, but noticed an issue that doesn’t happen with Bootstrap modals : when you for example pin the web browser window to one half of the screen, or when you zoom, with Bootstrap the modals have a maximal width that doesn’t overflow the viewport, whereas with rmodal, the modals may easily become too large and the right part of their content is then invisible (there is no horizontal scroll bar either)

RModal is not defined on website using RequireJS

I have a script which dynamically loads rmodal.min.js on my clients' websites and then tries to show a popup as usual.

It looks somewhat like this:

(function() {
    // this piece loads rmodal.min.js
    var d = document, g = d.createElement('script');
    g.type = 'text/javascript'; g.async = false; g.defer = true; g.src = 'somepath/rmodal.min.js';
    d.head.appendChild(g);

    // this piece waits for the script to load and creates a popup
    g.onload = function() {
        var popup = new RModal(document.getElementById('myPopup'));
        popup.open();
    };
}();

Usually it works very well. However, I encountered a website that uses RequireJS v2.1.2 library. RModal detects this and tries to load itself using "define" function. Obviously it fails somehow, since then I get an JS error when trying to create a popup (or just check for the RModal in the console):

ReferenceError: RModal is not defined

The method of loading the script is not an issue, it might as well be static <script> tag in HEAD. I even tried manually running the whole rmodal.min.js script through browser's console.

If I simply comment the lines in rmodal.min.js that are responsible for define/AMD support, everything works fine, since initialization is done using default fallback method. I'm talking about these lines of code:

typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.RModal = factory());

Am I doing something wrong here? Is it an error to expect that RModal / window.RModal object will be defined no matter how the library was initialized?
I'm not familiar with RequireJS and have no need for it - it was a random interaction between my script and other scripts on client's website.

I'd rather not make changes in rmodal.min.js (since it is an external library), so maybe there's some workaround?

Modal does not capture keyboard focus

When the modal is displayed, keyboard focus should move either to the dialog element itself or to the first form control.

While the modal is displayed, the user can still interact with elements behind the modal using the keyboard.

dialogCloseClass does NOT remove dialogOpenClass

Hi everyone. I would like to first thank you for the awesome work you put into this lightweight modal plugin. It's very versatile (for me at least) and I love how it integrates with animate.css.

I found a problem - when use dialogOpenClass: 'animated zoomIn' and then you use dialogCloseClass: 'animated zoomOut', everything works fine. But when you try to open the modal again, the modal doesn't show up because the old classes still remain for those elements - in this case, fadeIn and fadeOut still exists, as you can see via Inspect Element.

Here is an example: http://next.plnkr.co/edit/1xszc0nNrAsPLm7G
Click on "Show modal" and then click on "Close". Then try to to click on "Show modal" again and you will see that the modal doesn't actually show up. If you inspect the element, you can see that the old animate classes are still there.

Duplicate margin property in rmodal-no-bootstrap.css

In rmodal version 1.0.28, the margin property in .modal .modal-dialog in the file rmodal-no-bootstrap.css is duplicated :

.modal .modal-dialog {
    position: relative;
    margin: 30px auto;
    …
    margin: 0 auto;
}

Close modal when click on backdrop area

Awesome plugin, is really annoying using powerful libs just to popup a simple modal.

That said, I missed that default interaction to click outside the modal and close it. For some users, that is a default behavior. After that, probably a perfect modal lib.

Keep the good job.

Opening a popup gets broken by prototype.js

I had a misfortune of integrating a popup engine which uses RModal.js with a webpage that uses Prototype.js v1.7 (part of some Magento installation).

Trying to open a popup, e.g. like this:

var p = new RModal(...options here...);
p.open();

results in an exception:

TypeError: this.each is not a function prototype.js:883:5
findAll prototype.js:883:5
s.prototype.elements rmodal.min.js:1:2369
s.prototype.focus rmodal.min.js:1:2585
s.prototype._doOpen rmodal.min.js:1:1537
s.prototype.open rmodal.min.js:1:1227

The popup itself is displayed, but the code breaks here, e.g. "afterOpen" callback is not executed.

I've tracked the problem down to this line in RModal.js, function RModal.prototype.elements:

return [].filter.call(

It seems that Prototype.js substitutes "filter" function with its own "findAll" function which does not work correctly in this context (it tries to iterate over "NodeList" object and fails).

Every RModal popup with "focus=true" option is affected.

I know this is not RModal issue but rather a problem with extremely invasive Prototype.js library.
But maybe there is some walkaround you could suggest?

Maybe the code could be patched up to avoid using "filter" method and be more prototype-friendly? I can modify the popup engine, but I cannot modify the website.

Disabling the focus should obviously work, but that's a feature and I'd like to keep it :)

<SELECT> options are removed when modal dialog is not shown at first

This is strange....

In order to reproduce the problem, you can use this code:

< div class="modal" > < select >< option >Hello< /option >< /select > < /div >

The page will be rendered a (you will need to see this in Firebug, because when viewing page source, the code above will be displayed)

< div class="modal" > < select >< /select > < /div >

If I comment JavaScript instruction that converts the DIV into RModal out, the SELECT option appears. It is strange, isn't it?

If you does not comment the JavaScript out, but change the "display" attribute to "block", so that the dialog appears initially visible, the option is shown too.

Please check it.

EDIT:

When the page loads, and see the source with Firebug, the option is still there, but, when modal is shown, using open() method, all options are gone.

Thanks

closeTimeout is ignored in afterClose

The call to afterClose happens immediately regardless of closeTimeout despite the documentation stating otherwise:

{
      closeTimeout: 500 // Time to wait (ms) before afterClose() is called
}

RModal on website with broken RequireJS config

Hello,

I once had an issue with loading RModal on a website that uses RequireJS. That has since been fixed (see issue #22).

However, I encountered a website which, apparently, has a broken RequireJS configuration. Simply calling "require.config()" results in an error:

Error: Mismatched anonymous define() module

it follows with the problematic function code which is unimportant here, because I have no way to fix it (website belongs to 3rd party). At this point, my code is not even present on the website.

How can I make RModal ignore RequireJS (since it is obviously broken) and load itself the regular way?

You can tab out of the dialog

If the dialog is shown over the top of a form, then using Tab or Shift-Tab and the focus shifts away from the dialog and to an input on the form (so escaping the modality).

The most workable solution I have seen around this is to (A) insert dummy elements at the top and bottom of the modal dialog, and when a focus event occurs on the dummy elements, shift the focus back to an input inside the dialog. Also ideally (B) need dummy focusable elements at the beginning and end of the body so that tabbing away from the location bar and into the document can catch the focus shifting before the user tabs into inputs behind the modal dialog. I remember dojo had a traptabs() function that implements (A) see https://www.google.com/#q=dialog.js%20dojo%20traptabs

I have seen modal forms trying to disable all tabbable controls, but that is a fragile solution: firstly it is difficult to find all elements that can be tabbed into (inputs/textareas/anchors/buttons/scrollable-divs/tabindex=x/content-editable/video etc), and secondly it is difficult to avoid introducing subtle interaction bugs with existing code behind the modal dialog (setting or restoring element state like disabled/readonly/tabindex can lose state or otherwise stuff up).

You can see the fault in your plunker example - click Show Modal and type Tab three times, or click Show Modal and type Shift Tab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.