/    Sign up×
Community /Pin to ProfileBookmark

Button takes two clicks for onclick to work

I’m having problems with a form. On Mobile Chrome for Android, when the cursor is left in one of the text inputs, the button has to be clicked twice for onclick to work. This is on a page which has been up (and working) for years. Some recent change to mobile Chrome for Android has caused this problem to express itself. Here’s an example of the problem: https://www.englishpage.com/TEST/

To see the problem in action, try the above page in mobile Chrome on Android. Type “am going to write” into the first box, but leave the cursor in the box. Scroll down and click the “Check” button. The problems is not occuring in various desktop browsers. Occasionally, it works and the pop-up will work. But most of the time, it just bounces back up to the text input.

If I switch onclick to onmousedown, it works perfectly. It also works with ontouchstart, but that won’t validate. I actually need onclick because many students just tab through each blank and hit enter to check their work. Onmousedown won’t work with the enter button.

I have also already tried:
-adding cursor: pointer to css
-adding type=”button”

  • switching the button to a clickable div

  • DevTools Event Listener Breakpoints to step through Javascript, but onclick doesn’t fire the function at all until the second click
  • to post a comment
    HTML

    0Be the first to comment 😎

    ×

    Success!

    Help @cnomad spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.25,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...