You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Marcel Kinard (JIRA)" <ji...@apache.org> on 2013/02/20 14:11:12 UTC

[jira] [Created] (CB-2500) wp8: concurrent alerts can't be dismissed

Marcel Kinard created CB-2500:
---------------------------------

             Summary: wp8: concurrent alerts can't be dismissed
                 Key: CB-2500
                 URL: https://issues.apache.org/jira/browse/CB-2500
             Project: Apache Cordova
          Issue Type: Bug
          Components: WP8
            Reporter: Marcel Kinard
            Assignee: Jesse MacFadyen
            Priority: Minor
             Fix For: 2.5.0


I got a report from a customer that they did multiple concurrent alerts, and the second alert gets stuck (unable to close it) and you can't get out unless you press the back button, which closes the application.

Here is how to recreate:

index.html:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
            <h1>Apache Cordova</h1>
            <div id="deviceready" class="blink">
                <p class="event listening">Connecting to Device</p>
                <p class="event received">Device is Ready</p>
            </div>
        </div>
        <script type="text/javascript" src="cordova-2.3.0.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

js/index.js:

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // `load`, `deviceready`, `offline`, and `online`.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of `this` is the event. In order to call the `receivedEvent`
    // function, we must explicity call `app.receivedEvent(...);`
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);

        alert("First Alert");
        alert("Second Alert");
        alert("Third Alert");
    }
};

I will attach a proposed solution from the customer via a pull request. The idea is to walk up the parent's chain of OK buttons until we meet the NotificationBox object and remove that object from the root grid. 


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira