Problem with dynamic layout in page with fixed footer and a dialog #8511
Comments
One more important "fun fact" -- the problem occurs if the autocomplete This originally made me think the problem was in my code, but now I'm convinced it's some weird problem with fixed toolbar positioning. I'm guessing it's either a memory leak or a problem with |
Adding But even then the problem still occurs when you click outside of the list (even outside the window e.g. you click the developer console). The problem occurs both on Chrome 52 and latest 53, but NOT on Firefox 47. See logs from my blur test here: https://github.com/Eccenux/mJappis-test/tree/test/autocomplete-and-dialog/tests/onblur Notice how after input.blur Firefox simply does:
But Chrome does above and then:
PS: Firefox dev (50.0a2) behaves like Chrome. |
Right. So I'm giving up on this one. Here is a crazy workaround. The workaroundYou have to add this to all pages that has a button that opens a dialog and that has a dynamic layout. $(document).on("pageinit", "#page-with-dialog-open,#another-page-with-dialog", function() {
// JQM bug workaround
var properPageId = this.id;
$("[name=query]", this).on('blur.jqmBug', function(){
// wait for the bug to occur
var intervalId = setInterval(function (){
var currentPageId = $('.ui-page-active').attr('id');
// wait until page changed
if (currentPageId !== properPageId) {
// apply workaround if this is a dialog but url state is not set
if (location.hash.indexOf("ui-state=dialog") < 0
&& $('.ui-page-active').data('role') === 'dialog') {
$('.ui-page-active').removeClass('ui-page-active');
$('#'+properPageId).addClass('ui-page-active');
}
clearInterval(intervalId);
clearTimeout(timeoutId);
}
}, 10);
// assuming bug will occur after around 300 ms, so clear wait interval after that time
var timeoutId = setTimeout(function (){
clearInterval(intervalId);
}, 400);
});
}); AssumptionsIds of two pages that layout is dynamic (it's height can grow) are:
Selector of an input that changes layout height is |
Source code
Hi. I have a problem with my app that I was able to minimize to this app:
https://build.phonegap.com/apps/2238062/share
Built from this code base:
https://github.com/Eccenux/mJappis-test/tree/test/autocomplete-and-dialog
I could probably minimize it more but it took me 5 days to get to this one and maybe someone will have an idea what is going on :-).
Steps to reproduce
In app:
In Chrome in device emulation mode:
What supposed to happen
The text box should be filled with text from the selected hint.
What actually happens
The search options dialog is shown. And what is worse it is not active (clicking on buttons does nothing).
"Fun" facts...
After some hours of digging through weinre I've noticed some weird behaviours...
Android L, M and iOS 9 problem
Seems like problem occurs on both of them so is not even Android specific. What is even weirder is that older versions are fine -- both Android 4.1.2 and iOS 6.1.6 work fine.
Page activation not navigation
I noticed
ui-page-activated
is remove from the start page and added to the dialog. So what kind of "work" is:BUT the dialog is not actually opened (not navigated to). I know this because hash tag of the page is not changed. Also navigation back to the start page does nothing (
$.mobile.navigate('#page-start')
will not work).Problem is input-blur not list-click
The dialog appears after about 300 ms from input blur. Also clicking on the listview is not crucial for the error to occur (just clicking outside of the input box also trigger the dialog).
Scrolling
If you scroll the view (either user scroll or with
jQuery.mobile.silentScroll(50)
) the problem will not occur.Keyboard
If you hide the keyboard the problem will not occur.
Non-fixed position of the footer
If you change position of the footer to be non-fixed the problem will not occur. For the app in question you can change position of the footer/toolbar in its settings.
The text was updated successfully, but these errors were encountered: