Skip to content

Conversation

@mrdoob
Copy link
Owner

@mrdoob mrdoob commented Nov 4, 2020

Description

Changing the page's tabIndex when constructing OrbitControls was definitely not the right thing to do.

This also solves the problem of outlines showing in recent versions of Chrome when using OrbitControls.

@mrdoob mrdoob added this to the r123 milestone Nov 4, 2020
@mrdoob mrdoob merged commit 665d5e4 into dev Nov 4, 2020
@mrdoob mrdoob deleted the controls branch November 4, 2020 13:31
@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 4, 2020

It seems this breaks the key controls. Previously, it was possible to use the keys when clicking on the canvas:

https://raw.githack.com/mrdoob/three.js/dev/examples/misc_controls_orbit.html
https://threejs.org/examples/misc_controls_orbit

One way to solve this is to bind the keydown event listener to window. However, all key events will then be captured by the controls which was the original motivation for introducing tabIndex manipulation, see #16676.

@mrdoob
Copy link
Owner Author

mrdoob commented Nov 10, 2020

@Mugen87 What do you think of this kind of API for controls?

const controls = new OrbitControls( camera );
controls.listenPointerEvents( renderer.domElement );
controls.listenKeyboardEvents( window );

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 11, 2020

Would it be necessary to call listenPointerEvents() each time OrbitControls is created?

As an alternative to new methods it would be also possible to introduce a third (optional) ctor parameter:

const controls = new OrbitControls( camera, renderer.domElement, window );

@arodic
Copy link
Contributor

arodic commented Dec 6, 2020

Changing the page's tabIndex when constructing OrbitControls was definitely not the right thing to do.

I'm wondering what made you realize that @mrdoob? Would it make any difference if the user was expected to set tabindex manually?

@mrdoob
Copy link
Owner Author

mrdoob commented Dec 8, 2020

I'm wondering what made you realize that @mrdoob? Would it make any difference if the user was expected to set tabindex manually?

It's about the accessibility outline that Chrome started showing recently when the element has been tabbed into. One option was hiding the line (bad for accessibility), another option was removing this "auto tab" and let developers do it themselves when needed (opt in).

@mrdoob
Copy link
Owner Author

mrdoob commented Jan 8, 2021

Would it be necessary to call listenPointerEvents() each time OrbitControls is created?

Yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants