-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a focusin event that bubbles when focus changes #920
Comments
My inclination is to go with option 1 as it's a simple boolean switch. Additionally, since we're only using the |
I am on the fence. I agree that it will be easy for devs to forget that there is both Lets say that |
Because of the above, I am leaning toward option 2, but would be good to discuss again at dev meeting. |
@jessegreenberg would the advantage of using a |
Exactly! Thats what I was going for in the example in #920 (comment) |
Discussed during 1/7/19 dev meeting: We will proceed with supporting both |
// DOM spec is that focus events do not bubble while focusin events do
// allows for parents/composite Nodes to add listeners when children recieve focus
this.dispatchEvent( trail, 'focus', this.a11yPointer, event, false );
this.dispatchEvent( trail, 'focusin', this.a11yPointer, event, true );
|
Ideally we will add this change before the next developer meeting. Marking high priority. |
We need to get through #921 before we can finish this, marking this on-hold. |
The usage that originally caused this issue is no longer in the project. I think that we should close this issue. I'll meet you all over in #921 |
After the changes from phetsims/scenery-phet@2eead2b, phetsims/scenery-phet@cb7d61c, and phetsims/scenery-phet@eeb182f, I discovered that we can no longer add event listeners (at least for focus) to NumberControls or composite components that use NumberControl.
For example, the following produces no output:
however, within NumberControl, we can add a focus listener onto the Slider component that will be called.
@jessegreenberg and I tracked this down to the fact that we're not bubbling
focus
events in the scene graph. From thefocusinEmitter
inInput.js
:Essentially, the slider is triggering the focus event, but Scenery doesn't dispatch the event to the parent nodes.
We discussed 2 options for a fix:
focusin
input event that would bubbleThe main issue with option 1 is that there may be cases where allowing focus to bubble in all cases could either cause unanticipated behavior or lead to performance issues (e.g. for deeply nested nodes, checking for listeners on all parents could be an issue).
The second case would complicate the a11y API but would also mimic the DOM spec.
The text was updated successfully, but these errors were encountered: