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

Top of modal within iframe isn't in view when modal is shown on iOS #20352

Closed
psukmak opened this issue Jul 25, 2016 · 19 comments
Closed

Top of modal within iframe isn't in view when modal is shown on iOS #20352

psukmak opened this issue Jul 25, 2016 · 19 comments

Comments

@psukmak
Copy link

psukmak commented Jul 25, 2016

os: IOS 9.3.3
Browser: Chrome , Safari, Firefox
Mobile : iphone 5, 6
Bootstrap : v4.0.0-alpha.2

On first image, I have form put into iframe.
On second imag,I have change location button that put into middle of the form above. when click will show modal.
13615388_1209496925747718_8387065026170878775_n ............................... 13754280_1209498572414220_7091115259155697470_n

On nexus 5 android version 6.0.1

  • When click change location button, it shows perfect. Header of modal show first.
  • Form behide of modal cannot scroll
    android1

On Iphone 5

  • When click change location button, it will show not right. Header of modal not show first. It relates to height of the iframe.
  • Form behide of modal can scroll
  • When show modal it will be put modal-open class into body in the iframe and modal-open class is overflow: hidden; but this css not working on iphone

13775828_1209496902414387_616818270966338745_n

@cvrebert cvrebert added the v4 label Jul 25, 2016
@cvrebert
Copy link
Collaborator

On nexus 5 android version 6.0.1

Please open a separate issue for that. Much appreciated.

@cvrebert
Copy link
Collaborator

Also, we cannot debug screenshots. Please make a reduced test case using JS Bin (or similar).

@psukmak
Copy link
Author

psukmak commented Jul 26, 2016

On nexus 5 everything OK. I just show right case.

@psukmak
Copy link
Author

psukmak commented Jul 26, 2016

about on iPhone, I upload example code to my server

http://appsoftplus.com/index-test.html

@chaiyot
Copy link

chaiyot commented Jul 26, 2016

There are 2 issues for iframe in Safari's iPhone from that example.

  1. Modal doesn't show at the correct position (center of the page) if we put the button down at some level in the iframe (if we put the button at the beginning of iframe it's still works).
  2. Contents inside iframe stop displayed at some point for long contents (Cannot scroll down more even though contents are not yet finish) on iPhone.

@chaiyot
Copy link

chaiyot commented Jul 29, 2016

We've manually fix modal show incorrect position in iframe on iPhone by calling focus event again using javascript.It's works.

@small-carbon
Copy link

@psukmak Did you solve?

@small-carbon
Copy link

@chaiyot Did you solve?

@psukmak
Copy link
Author

psukmak commented Aug 24, 2016

@majianxiong No, I did not. I waiting update from bootstrap
but you can ues manually fix:
$('#myModal').on('shown.bs.modal', function (e) {
// focus somewhere in modal
});

$('#myModal').on('hidden.bs.modal', function (e) {
// focus somewhere in body
});

@small-carbon
Copy link

image
image
But not in the middle

@small-carbon
Copy link

@psukmak $(document).scrollTop() is zero

@small-carbon
Copy link

@small-carbon
Copy link

problem is resolved

@cvrebert
Copy link
Collaborator

cvrebert commented Sep 6, 2016

about on iPhone, I upload example code to my server
http://appsoftplus.com/index-test.html

Copied to Plunker for durability: https://plnkr.co/edit/jYMgPUsBwAuTCCze3KWe?p=preview

@cvrebert
Copy link
Collaborator

cvrebert commented Sep 6, 2016

  • Form behind of modal can scroll
  • When show modal it will be put modal-open class into body in the iframe and modal-open class is overflow: hidden; but this css not working on iphone

This portion seems to be referring to https://bugs.webkit.org/show_bug.cgi?id=153852 , which we've already reported to WebKit.

@cvrebert cvrebert added the js label Sep 6, 2016
@cvrebert
Copy link
Collaborator

cvrebert commented Sep 6, 2016

When click change location button, it will show not right. Header of modal not show first. It relates to height of the iframe.
[...]
Modal doesn't show at the correct position (center of the page) if we put the button down at some level in the iframe (if we put the button at the beginning of iframe it's still works).

I can confirm that the user sees the middle of the modal in iOS Safari and the top of the modal in Android Chrome, when the modal within the iframe is initially shown.
Will need to do some more testing to determine who's deviating from the standards and how.

@cvrebert cvrebert changed the title Modal not fixed in iframe Safari iphone Top of modal within iframe isn't in view when modal is shown on iOS Sep 6, 2016
@jeremyjcpaul
Copy link

I've also been having problems with this issue. See this JS Fiddle https://jsfiddle.net/tmfq0rnm/4/. It works perfectly everywhere except on iOS due to the iframe issue. On iOS tapping "Click here" will cause the iframe to jump to the bottom rather than to where the modal is displayed. Do we know what the status is of this issue? Is there a good fix for it in the meantime? Looking at the previous comments it seems like all the "fixes" may brake other things which I need to avoid.

@cristianocordeiro07
Copy link

cristianocordeiro07 commented Feb 23, 2017

I fixed a similar issue with the following solution:

$('#id_iframe').load(function () {
resizeIframeForm();
}

function resizeIframeForm() {

if( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
	// block scroll for mobile;
	// causes underlying page to jump to top;
	// prevents scrolling on all screens
	$('body.modal-open').css('overflow', 'hidden');
	$('body.modal-open').css('position', 'fixed');
} 

}

@mdo
Copy link
Member

mdo commented Jan 10, 2021

This is super stale, and I'm not seeing a clear issue anymore with a live demo. I updated the last Fiddle link to the latest version of v4.x and things look okay to me I think? https://jsfiddle.net/deghcsuv/

Closing out.

@mdo mdo closed this as completed Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants