Search code examples
htmlcssoperasmart-tv

Disable Spatial Navigation


I develop smart tv project on Opera TV. Can I disable spatial navigation in my project? Because I create method for control app by javascript and when I navigate app, my method in JS and spatial navigation work both. How can I do this?


Solution

  • If you rely on own key navigation, you shloud prevent default keydown action of browser.

    window.addEventListener("keydown", function (e) {
      e.stopPropagation();
      e.preventDefault();
      //your navigation code (VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN...)
    }, useCapture);
    

    Preventing default spatial navigation: https://dev.opera.com/tv/functional-key-handling-in-opera-tv-store-applications/#prevent-default