Dialog launched from footer breaks layout

Dialog launched from footer breaks layout

Hi,

I have a button in my page's footer that opens a popup dialog. The problem is, whenever I close the dialog (click X on top left), the page layout breaks and elements have the wrong vertical position (they are moved up so top of page is inaccessible). For this bug to happen, the page must be tall enough to show a scrollbar.

This doesn't happen in desktop Firefox but happens in Android's browser (tested on my phone, and in Android Emulator 1.6-2.2).
EDIT: Just noticed it happens in Google Chrome, so you can easily test this on a desktop computer. Just make sure the window is small enough to show a scrollbar.

Anyone know a way around this?

Thanks.


Test code:
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Sears Rebate Finder</title>
  5. <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
  6. <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
  7. <script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
  8. </head>
  9. <body>
  10. <div data-role="page" id="mypage">
  11. <div data-role="header">
  12. <h1>Top Header</h1>
  13. <a href="#email-dialog" data-rel="dialog">Email Popup 1 (works)!</a>
  14. </div>
  15. <div data-role="content" data-theme="d">
  16. <div>
  17. <ul id="cat-results-list" data-role="listview" data-theme="d" class="ui-grid-a">
  18. <li>List item...</li><li>List item...</li><li>List item...</li>
  19. <li>List item...</li><li>List item...</li><li>List item...</li>
  20. <li>List item...</li><li>List item...</li><li>List item...</li>
  21. <li>List item...</li><li>List item...</li><li>List item...</li>
  22. <li>List item...</li><li>List item...</li><li>List item...</li>
  23. </ul>
  24. </div>
  25. <p>
  26. Some more content text...
  27. </p>
  28. </div>
  29. <div data-role="footer">
  30. <h1>Bottom Header</h1>
  31. <a href="#email-dialog" data-rel="dialog">Email Popup 2 (doesn't)!</a>
  32. </div>
  33. </div>
  34. <div data-role="page" id="email-dialog">
  35. <div data-role="header">
  36. <h1>My Dialog</h1>
  37. </div>
  38. <div data-role="content" data-theme="d">
  39. Hi from dialog!
  40. </div>
  41. </div>
  42. </body>
  43. </html>