Open EloB opened 4 years ago
Hi @EloB, I think this polyfill won't work with canvas/webGL. In general, the polyfill moves the focus among focusable DOM elements. Therefore the canvas element will be considered as just one element, and the focus won't move inside it.
I haven’t used the specification before. It won’t be extendable?
HTML5 canvas element doesn't remember contents drawn inside it. Most of JS libraries working with canvas element maintain there own data structure to remember what is drawn inside the canvas. There are some complexities as below :
@abhijeetk, Great description!
If someone wants to use something like spatial navigation polyfill, you need to make a data structure for each object inside
You can have DOM elements inside your canvas and have them be focusable, but that is managing the focus manually via calling the focus method and the elements don't have layout so don't think that spatial nav would be able to help here.
See example on MDN: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded
Can I use this somehow with non DOM/HTML things like Canvas/Webgl. I been looking for something like this for Pixi.js.
Haven't had time to dig deep into this.