spatial-navigation icon indicating copy to clipboard operation
spatial-navigation copied to clipboard

container.getSpatialNavigationContainer is not a function

Open perqa opened this issue 3 years ago • 2 comments

Added the polyfill to a web app. Key navigation works for a start, but after some navigation the following error is thrown on every key event:

Uncaught TypeError: container.getSpatialNavigationContainer is not a function
    at navigate (spatial-navigation-polyfill.js:207)
    at spatial-navigation-polyfill.js:110

perqa avatar Dec 10 '21 14:12 perqa

What is the last element with focus before this happens?

Yaffle avatar Dec 11 '21 20:12 Yaffle

Here is one example:

Screenshot 2021-12-12 at 15 19 55

The error seems to occur when navigating down from the top menu into the scroll area, but not immediately. Nothing gets focus in the scroll area, and on the third key press downwards, the error occurs. Scrolling back up again three steps or more doesn't help, as long as the top menu is outside the screen. If use the mouse to bring the top menu into view, the error stops happening, as long as I stay in the top menu.

  • The app I'm using as an example is this: https://github.com/WayneMorganUK/sveltekit-movie-app (Movie tab)
  • There is a demo deployment of the app here: https://sveltekit.athena-designs.com/ (without spatial-navigation-polyfill - the demo isn't mine)
  • I have included spatial-navigation-polyfill in the head of src/app.html

Some more detailed console.logs of just before until just after the error occurs: Screenshot 2021-12-15 at 09 21 42

To reproduce, just press arrow down a few times, starting from top menu Movie tab.


On the People tab, spatial navigation works as expected (except there is no visual cue of focus). The DOM structure looks pretty much the same on in the Movie tab.

perqa avatar Dec 12 '21 14:12 perqa