cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederico Costa Galvão (JIRA) <>
Subject [jira] [Commented] (CB-3621) Overriding Back Button behavior can lead to inconsistent state
Date Thu, 04 Jul 2013 08:41:19 GMT


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

View raw message