Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7920701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:18:57+00:00 2026-06-03T16:18:57+00:00

I have a mobile web app that displays a dialog box within a position:

  • 0

I have a mobile web app that displays a dialog box within a position: fixed element overlaying the entire screen. No matter how much content is displayed or how far the page has scrolled, the overlay element dims the page content and the dialog appears on top of it all. There is an <input type="search /> field in the dialog.

On Android, when the user taps the input field to give it focus, some pretty erratic behavior often (but not always) ensues:

  • The soft keyboard appears, then immediately disappears.
  • The underlying page (covered by the overlay) scrolls by a few dozen pixels, sometimes up, sometimes down, sometimes in both directions, and sometimes repeatedly. This also happens when the input field loses focus.
  • The overlay element momentarily shifts a few pixels down and right, revealing the underlying content along the top and left edges of the screen. (It returns to place less than a second later.)

This is on Android 2.3.4 with the built-in browser. It may also occur on other Android versions.

The page constructed something like this:
(Keep in mind that some of these quirks only show up when the page contains enough content to allow scrolling.)

<head>
  <style type="text/css">
    #menuoverlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background-color: rgba(0,0,0,.75);
    text-align: center;
    }
    #menu {
    display: inline-block;
    margin-top: 1em;
    border: 3px solid #02b;
    border-radius: 8px;
    padding: 1ex;
    background-color: black;
    color: silver;
    }
  </style>
</head>

<body>
  <div id="menuoverlay">
    <div id="menu">
      ...menu items...
      ...menu items...
      <form action=""><input type="search"/></form>
    </div>
  </div>

  <div id="content">
    ...lots of stuff...
    ...lots of stuff...
    ...lots of stuff...
  </div>
<body>

Has anyone else seen this behavior? Have you found a way to prevent it?


Scouring the web led me to a few reports of similar problems. Here’s a summary of what I have read so far:

  • On many Android devices, the built-in browser apparently does not use WebKit’s input fields the way one would expect. Instead, when the html-defined fields gain focus, the browser attempts to cover them with new text widgets that it creates separately.
  • These duplicate text fields often ignore css styling, creating an effect where the fields look styled until they gain focus, and then suddenly revert to the system default style.
  • The Android browser often fails to position these duplicate fields correctly. When misplaced, they are sometimes visible, but other times only move the focus targets without any visual indication that they have moved.
  • These problems often show up when an input field’s ancestor element has styles like transform: translate3d(), -webkit-backface-visibility, or position: fixed.

Here are some relevant links:

Android Browser textarea scrolls all over the place, is unusable

How can I style an HTML INPUT tag so it maintains CSS when focused on Android 2.2+?

Android 2.2/2.3’s Native Browser and Fixed Positioning

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:18:59+00:00Added an answer on June 3, 2026 at 4:18 pm

    I managed to prevent the momentary overlay shift by setting outline: none on my input element.

    I got the wild page scrolling and disappearing keyboard to settle down by setting overflow: hidden on the html body when showing the dialog, and then removing it again when hiding the dialog. This has a nasty side effect of resetting the page’s scroll position, so I save it and restore it as necessary, and wrap all this hackery in conditionals so it only runs on Android. (I hope my Android users won’t be too distracted when they see the page contents change beneath the semi-transparent overlay while the dialog is open.)

    Interestingly, I was also able to prevent the wild page scrolling by catching the touchstart event on my overlay element and calling preventDefault(). This makes me wonder if all this madness was caused by a sequence of events like this:

    • touchstart bubbles up to the document root
    • browser sees touchstart where the duplicate input field was placed
    • browser gives focus to the input field
    • soft keyboard appears to allow typing in the input field
    • viewport gets resized to accommodate the soft keyboard
    • resized viewport during touch event looks like a touch drag to the browser
    • spurious drag causes the page to scroll and dismisses the keyboard

    I didn’t end up catching touchstart to solve the problem, because it prevented the input field from gaining focus, and calling focus() from javascript just didn’t work. I have read that the Android browser disables the focus() method on input fields, which would explain this behavior. Perhaps it does this because it wouldn’t work with the duplicate text widgets it creates over the html-defined fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple web mobile app that is calculating values in given fields.
I have found that while using the <meta name=apple-mobile-web-app-capable content=yes /> tag in iOS
I have a web app that I wrote for mobile Safari, and added the
I have been doing some mobile web app testing and have noticed that the
I'm building a web app using jquery mobile that will have lots of images
I have a jquery mobile web app. On my iPhone when I am on
I'm working on a mobile web app, and in my page I have a
I'm making a mobile web app. At the top of the page, I have
I have a little HTML5 web app for mobile devices (running inside PhoneGap/Cordova). I
I have developed a Mobile application that connect to my Web Servie via RESTful

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.