bbc / lrud

Left, Right, Up, Down. A spatial navigation library for devices with input via directional controls.
Apache License 2.0
98 stars 21 forks source link

[Feature] Unregister options #24

Closed thomascgray closed 5 years ago

thomascgray commented 5 years ago

Description

A new config object is given to unregisterNode(). One of these options, forceRefocus will make LRUD find a new node to focus on if unregistering the currently focused node.

To match current behaviour, forceRefocus defaults to true.

Also fixes an underlying refocus on unregister issue.

Motivation and Context

Suggested by https://github.com/bbc/lrud/issues/23

Agree in principle - there are simply some scenarios where LRUD will not be able find a good fit to focus on. In this case, the developer should call assignFocus after unregisterNode in API-land.

How Has This Been Tested?

New unit tests

Screenshots (if appropriate):

Types of changes

Checklist:

thomascgray commented 5 years ago

@NickGoward how do this look to you?