Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-4547

The menubutton event blocks the next event

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.9.0, 3.0.0
    • None
    • cordova-android
    • Compiled in Fedora 17, tested on Android 4.2 LG Optimus G and Galaxy Note 2

    Description

      Steps to reproduce

      1. Download the latest release of cordova
      2. Create a new cordova proyect for android with the create script
      3. Replace the contents of assets/www/index.html with:
      index.html
       
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
      <html>
        <head>
          <title>Cordova Menu Button Example</title>
          <!-- From: http://docs.phonegap.com/en/3.0.0/cordova_events_events.md.html#menubutton -->
          <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
          <script type="text/javascript" charset="utf-8">
      
          function onLoad() {
              document.addEventListener("deviceready", onDeviceReady, false);
          }
      
          function onDeviceReady() {
              document.addEventListener("menubutton", onMenuKeyDown, false);
              document.addEventListener("click", onTap, false);
          }
      
          function onMenuKeyDown(e) {
          	alert("menu: "+e);
          }
      
          function onTap(e) {
          	alert("click: "+e);
          }
      
          </script>
        </head>
        <body onload="onLoad()">
        </body>
      </html>
      
      
      1. Build and install to an Android device
      1. Press menu and press ok on the alert several times

      Expected behavior

      The alert("menu") should show up every time menu is pressed

      Actual Result

      The alert shows up like this:

      1. menu press: It is displayed
      2. menu press: It is displayed
      3. menu press: It is not displayed
      4. menu press: It is displayed
      5. menu press: It is not displayed
        and so on.

      Another way to reproduce:

      1. Run the previous cordova application on Android
      2. Press menu and press ok on the alert twice
      3. swipe the screen
      4. Press menu (the alert is displayed)
      5. swipe the screen
      6. Press menu (the alert is displayed)
      7. swipe the screen
      8. Press menu (the alert is displayed)
        and so on....
      9. Press menu (the alert is displayed)
      10. Tap the screen (the alert("click") is not displayed)
      11. Press menu (the alert is displayed)
      12. Tap the screen (the alert("click") is not displayed)
        and so on...

      Final thoughts

      When the menu button is pressed the next event is ignored.

      thanks.

      Attachments

        Activity

          People

            bowserj Joey Robert Bowser
            jamartinezc Jorge Andrés Martínez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: