eureka2 / ab-datepicker

An accessible and bootstrap compatible datepicker
MIT License
63 stars 55 forks source link

Opening Modal View on a Modal #26

Closed kirandeep123 closed 6 years ago

kirandeep123 commented 7 years ago

I tried to open calendar modal view in a popup modal but I am seeing inline view i.e. not able to see close button and modal view in a modal .

Is it some Issue or do I need to include some attribute ? Please Suggest . Please find attached Screenshot which shows date-picker modal in a popup modal .

eureka2 commented 7 years ago

I do not see the attached screenshot

kirandeep123 commented 7 years ago

suggest

eureka2 commented 7 years ago

Go to http://eureka2.github.io/ab-datepicker/ and click on modal: image

The script is then:

$(document).ready(function() {
    $('#date').datepicker({
        modal: true,
    });
});

image

You can see the close button ....

kirandeep123 commented 7 years ago

Hi , That is Fine .I am using modal attribute and this is working fine in all locations in our application but the issue is when I already have a modal/popover say which is opening in an iframe and I am then implementing datepicker on that modal with this modal attribute set to true its not working and is showing me the same inline view .

If you have checked the screenshot I attached its a modal which is opening in an iframe and I am trying to open a datepicker modal within that modal .

let me know if you still have questions/concerns/suggestions

eureka2 commented 6 years ago

I will try to reproduce this issue. Which component do you use for your modal dialog?

kirandeep123 commented 6 years ago

Hi , we are using iframe to open modal dialog and rendering our JSP in that div which contains this frame . You can find code here :

eureka2 commented 6 years ago

Ok, but where are the scripts defined? In the page? in the iframe? Do you use bootstrap modal.js : https://getbootstrap.com/docs/3.3/javascript/#modals ? Please, give me more elements so that I can test!

Best regards

kirandeep123 commented 6 years ago

Hi , Scripts are defined in the page . No we are not using anything like bootstrap modals . we are just setting modal attribute to true and we are done and this is working as intended on normal pages but issue is with iframe .

what types of elements are you asking for ?

eureka2 commented 6 years ago

The title of this issue is

Opening Modal View on a Modal

So, there are two modal windows. the first is your modal dialog box, the second is the datepicker.

To my knowledge, an iframe or a JSP can not popup a modal dialog box on the browser, only a Javascript code can do that.

In my opinion, there is a conflict between this Javascript code and the datepicker.

If you do not say what you use as Javascript code to display your modal dialog box, I will not be able to test.

eureka2 commented 6 years ago

I partially reproduced your dialog box here and there is no problem

kirandeep123 commented 6 years ago

Can you share the code or exactly what you used ?

eureka2 commented 6 years ago

The HTML page: modal-on-modal.html.txt

The content of the IFRAME: modal-on-modal-iframe.html.txt

kirandeep123 commented 6 years ago

If I close main modal without selecting any date after opening datepicker and again open modal from ' add remainder ' button ,datepicker remains open .

can you please check on this ?

eureka2 commented 6 years ago

The datepicker does not know that it's in a modal and that this modal has been hidden. It is the responsibility of the app to handle this.

To illustrate, I added this in the iframe code:

window.parent.$('#myModal').on('hidden.bs.modal', function (e) {
   $('#send-date').datepicker('hide');
})
kirandeep123 commented 6 years ago

Okay it fixes the problem I guess . Thanks for working on this .

eureka2 commented 6 years ago

You're welcome !