You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Frederico Costa Galvão (JIRA)" <ji...@apache.org> on 2013/07/04 10:41:19 UTC

[jira] [Commented] (CB-3621) Overriding Back Button behavior can lead to inconsistent state

    [ https://issues.apache.org/jira/browse/CB-3621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13699845#comment-13699845 ] 

Frederico Costa Galvão commented on CB-3621:
--------------------------------------------

I think it would be better if we didn't have to override window.history.back.

The requested feature (be able to let the "native" event run AND be able to control 'backbutton' at the same time) can be achieved by changing the 'if' instead of the 'else' of said implementation.

I'm not familiar with the way callbacks are managed on cordova.js, and am very new to C# and WP8, but if it's possible to, right after "cordova.fireDocumentEvent('backbutton');", get the result of the function bound to 'backbutton', we could set e.Cancel with it's value. This would mimic common DOM events, with 'false' preventing default behaviour.


                
> Overriding Back Button behavior can lead to inconsistent state 
> ---------------------------------------------------------------
>
>                 Key: CB-3621
>                 URL: https://issues.apache.org/jira/browse/CB-3621
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: WP7, WP8
>    Affects Versions: 2.8.0
>            Reporter: Jesse MacFadyen
>            Assignee: Jesse MacFadyen
>             Fix For: 2.9.0
>
>
> The current implementation does the following:
> - if the app has overridden the back button, by using document.addEventListener, then the backbutton event is passed to the page, and discarded.
> - else, the library will call window.history.back and if the page changes, discard the event.
> In all other cases the event will be passed to the OS and the app will exit.
> It is possible that an app is overriding the backbutton, but still needs the ability to exit at some point ( in response to a backbutton event ).
> If the page history has changed, then the framework would swallow the event, so it is impossible to get this behavior.
> We need to either add a programmatic way to exit the app in response to a back-button press, or find a way to signal the framework that even though I am overriding the backbutton, the app should still pass the event on to the OS.

--
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