File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -675,11 +675,30 @@ var KeyboardPlugin = new Class({
675675 var key = keys [ code ] ;
676676 var repeat = false ;
677677
678- // Override the default function (it's too late for the browser to use it anyway, so we may as well)
679- event . stopPropagation = function ( )
678+ // Override the default functions (it's too late for the browser to use them anyway, so we may as well)
679+ if ( event . cancelled === undefined )
680680 {
681- event . cancelled = true ;
682- } ;
681+ // Event allowed to flow across all handlers in this Scene, and any other Scene in the Scene list
682+ event . cancelled = 0 ;
683+
684+ // Won't reach any more local (Scene level) handlers
685+ event . stopImmediatePropagation = function ( )
686+ {
687+ event . cancelled = 1 ;
688+ } ;
689+
690+ // Won't reach any more handlers in any Scene further down the Scene list
691+ event . stopPropagation = function ( )
692+ {
693+ event . cancelled = - 1 ;
694+ } ;
695+ }
696+
697+ if ( event . cancelled === - 1 )
698+ {
699+ // This event has been stopped from broadcasting to any other Scene, so abort.
700+ continue ;
701+ }
683702
684703 if ( event . type === 'keydown' )
685704 {
@@ -723,6 +742,12 @@ var KeyboardPlugin = new Class({
723742 }
724743 }
725744 }
745+
746+ // Reset the cancel state for other Scenes to use
747+ if ( event . cancelled === 1 )
748+ {
749+ event . cancelled = 0 ;
750+ }
726751 }
727752 } ,
728753
You can’t perform that action at this time.
0 commit comments