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

Registering/Unregistering sibling nodes that start with the same string causes issues #21

Closed thomascgray closed 5 years ago

thomascgray commented 5 years ago

Describe the bug Internal LRUD state uses string paths to determine some of its logic.

The processes around these is broken if 2 siblings start with the same series of characters

To Reproduce


nav.registerNode('root');
nav.registerNode('brand');
nav.registerNode('brand-content');

nav.unregisterNode('brand');

After this unregister call, brand-content is still inside the tree, but a call to getNode('brand-content') will return undefined, as its been removed from internal state.

Expected behavior An unregister should not break internal state around pathing.