Trying to enhance accessibility, I am working on enabling the camera orbit of my model viewer using arrow keys immediately after dismissing the poster. The challenge is that currently, I can only control the camera with arrow keys after interacting with the model-viewer a second time (e.g., clicking to dismiss the poster and then needing to click on the 3D model at least once). This setup hinders accessibility.
Is there a way to make the model viewer accept keyboard input without the prerequisite of clicking or touching the 3D model first? I have attempted the following:
- Using the
focus();
function on my model-viewer element, as well as on my.userInput
div within it, and the canvas element inside that - Setting the tab indexes of each element to 1, but it did not work
- Applying
delegateFocus
on the elements - Utilizing the native
enableInteraction();
function of model-viewer - Adding an event listener when the poster is dismissed, using
this.addEventListener('keydown', this[$modelViewer].value?.onKeyDown);
I confirmed that these elements are manipulated/appended correctly, suggesting that focusing and setting tab indexes do not directly enable model-viewer to receive keyboard input initially.
What steps should I take to compel model-viewer to accept keyboard input right after dismissing the poster and loading the 3D model?