-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Wrong positioning of popover on IOS #3638
Comments
I was facing this problem on one of my projects. http://stackoverflow.com/questions/7970389/ios-5-fixed-positioning-and-virtual-keyboard . Shortly: fixed elements scrolls in iOS browsers, then virtual keyboard is opened. Moreover, devs from Apple keep this behaviour at least in a 5 iOS versions in a row. So probably it's a feature and they aren't going to fix it. I can envestigate, how to solve this in popover, if you want. |
To override this behavior I check if it's IOS and if
|
Sorry, missed by clicking on the button :) |
Seems like we can safely change this https://github.com/callemall/material-ui/blob/master/src/popover/popover.jsx#L203 to |
I don't mention, that this will not solve this issue, because |
#3144 sorts this - we had the same issue - has become a little distracted... |
@newoga check this one out too RE Popover |
Is there any progress? The documentation site on version 0.15.0 has the same issue. |
+1 @w01fgang I tested your solution and it works. The downside is that I would have to maintain a fork of material-ui and include jquery to make it work. Have you found a way to get the offset without jquery? |
@nsantini yes I have the way.
And here's the function for finding needed position:
|
@w01fgang legend! |
could we make a PR with this code? |
I'm missing something but I can't get the fix to work. I tried using your Material UI branch @w01fgang but that didn't work either. Top position is still incorrect. That's my autocomplete:
Am I missing something ? Thanks so much |
@Taakn can you show the output of device detection helper?
|
@w01fgang Thanks for your reply. I'm actually getting My package.json looks like this, is that correct ? Otherwise what would be the best way to get your solution ? "material-ui": "git+https://github.com/w01fgang/material-ui.git#fixPopoverIOS", Thanks again |
@Taakn When you install from git repo, it installs in folder 'material-ui-build'
Otherwise it doesn't installs.
|
Hi @w01fgang thanks for your help. When doing an npm install I am getting an unmet peer dependency error (I am using [email protected] and your package requires 0.16.0-alpha ?) but I'm not sure that would really matter. However I am getting an Do you know what could be the problem ? Please let me know if you can think of anything else. Thanks again |
@Taakn sorry, my mistake. Maybe I need to sleep more 😄 |
Thanks @w01fgang it took a little bit of work but it's working. It's interesting but my desktop Safari is sending the iPhone user agent when I'm debugging. Anyway thanks again! |
I was digging into that issue last weekend. It seems that the proposed fix (#4638) is only working fine in that context but breaking the others. I believe that the only way to solve that issue is to expose a property to enable / disable the fixed positioning. |
The problem is in the fixed positioning in IOS. Edit: |
@PhilippSpo That's the expected behavior on an emulator. Please try it in an iPhone simulator / real device. |
@PhilippSpo 's issue reproduced for me on a real device too
|
I'm also experiencing this issue on iOS 10.3.1 in Safari and Chrome. It's happening on the documentation site like @PhilippSpo 's example, but the Popover is appearing so far down that it's off the screen of my iPhone 6 so I can't even see it. Something seems to have changed since #4638 was implemented. |
I am also experiencing this issue– it's specifically related to scroll on mobile screens. I see it occurring in my Chrome devices view. |
For what it's worth, this doesn't seem to happen when you use the I wonder if it has something to do with the timing of setting the Edit: no progress, but I feel more sure it's related to the text field having focus. |
More info! I am able to correct the issue on actual devices when the components live in a scrolling body. Originally they were in a scrolling div. Once they live as part of the scrolling body the bug appears in the Chrome devices tab but not in the iOS simulator, which is good enough for now! TLDR when there's a focused text input in a scrolling container, and that container is scrolled, the autocomplete's popover appears where it would if the div were not scrolled. |
@devinivy are you saying you have a fix for this? if so, please share! ;-) |
My fix was to ensure the autocomplete field wasn't scrolled within a scrolling div. Instead I recreated the layout of my page to have a scrolling body. Originally the layout consisted of a full-height div that scrolled, which is what seems to have triggered the issue. |
@devinivy Geez, I cannot use your fix :/ |
I think the core issue, is that older ios version dont support see: |
Problem Description
Popover doesn't seen on IOS when I type in Autocomplete field.
I guess I found why.
When I start to interact with other parts of application, the popover flies from top.
I found that div with popover has wrong position. For example: the text field has absolute offset position 916px and popover has
top: 294px;
.I think that in IOS
position:fixed
has different behavior, positioning starts from top of the page, not of the screen.Versions
The text was updated successfully, but these errors were encountered: