Ticketfly/ember-keyboard

Scoped events

Closed this issue · 0 comments

Events are only triggered on the currently focused component. If the currently focused component does not have a listener registered for that event, it will optionally bubble up through parent views until it successfully triggers an event or terminates at the top level.

This will allow us to have contextual key responses, such as pressing the down arrow to navigate a ul, as well as app-wide key responders, such as the s key taking you to the search bar or Escape opening the account menu dropdown.

UPDATE:

tldr, this approach is too invasive.

Until we get routable components, the top level view is still that, a view. That means to support this, we'll need to use the deprecated application view. In turn, our consuming app will have to enable legacy views. This can be done by adding _ENABLE_LEGACY_VIEW_SUPPORT: true to EmberENV.

Additionally, this will require us to reopen the View and Component class to inject observers that will alert ember-keyboard when the component gains and loses focus. This will still be the case, even with routable components.