-
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
Display.focusProperty is not properly instrumented #936
Comments
The question to answer is: (How) can we instrument a static property based on a flag that is only set based on instances? Perhaps we need more of a global. Since by the Sim instance is created, the Display's focusProperty has already resloved into a non-instrumented instance. |
I encountered this in https://github.com/phetsims/phet-io-wrapper-sonification/issues/73 where the instrumentation of the Display.focusProperty wasn't happening when accessibility was enabled, it was only happening when the ?a11y query parameter was added. |
I am assuming that IO instrumentation must occur at instantiation of the Property, is that correct? I am not seeing any great places to indicate accessibility is enabled in a more global way. But I am also not very familiar with how sims start up. Can we make Display.focusProperty not static? |
For phet-io, we are lucky because it is a brand. That is set before loading any of the requirejs modules. With a11y it seems harder. Perhaps we can brainstorm more sometime.
I don't want to rule it out, but it seems like it boxes SCENERY/Display into a corner. We likely only want to support a single focus for the whole frame, not just divided on display instances. |
I ran into this again in correlation with recent solidification and validation of phet-io api (through the baselines file). It became impossible to run the sonification wrapper unless a11y was provided as a query parameter. In the above commit I did a bit of scary hackary to get things working. I ended up defining the instrumented focusProperty in the constructor, assigning it as a static there conditionally based on What I would have preferred to do would probably be to set @jessegreenberg please review. This be better, I just know it. How? Tagging @samreid in case he can think of anything. |
Would it work to always create and instrument the Focus?
And can you please provide links for sonification wrappers that should work with this? |
I would be OK with always instrumenting focusProperty, as long as we make it clear that this is specific to keyboard/a11y focus (not pointer input). If always instrumented then it could be moved out of the constructor. Alternatively, maybe we should reconsider whether focusProperty needs to be static. I think our argument was "A document can only have one element with focus so multiple Displays in a single document should share a single focus too". But it seems reasonable to me for each instance of Display to have its own focus. |
@samreid here is the link to the main sonification launchpoint. http://localhost/phet-io-wrapper-sonification/sonification.html I was using the first GFLB basics link last night with some alterations. First I built GFLB locally for phet-io, and then I went to
That makes sense. Does your work on zooming inform this at all? For example, if there was a strategy we may be pursuing where we were to add a smaller display on top of the sim as a "magnifier" display. That sort of solution may benefit from having display be static, so they bother could respond to the same Node (I say this with a big shrug over here). On the other side, I can see a usage where we would want to maintain the current focus for a display, so that we wouldn't look track of it when alternating between two display (even though only one of them would have focus at the same time). Which solution are you leaning towards?
|
The case you describe is possible, but hasn't been seriously considered yet. I think it is much more likely we will continue with more "standard" types of web zoom and magnify. Either way, I think that could be implemented with on Property per Display instance too because the focused node would be attached to both displays. I think I am leaning toward one Property per Display instance, but I really don't feel strongly one way or the other. |
What is the problem with the |
I don't think there is a problem with it, I perhaps just think it is slightly more unclean because it provides a useless item to most phet-io sims (since the majority don't have a11y enabled). Recognizing from https://github.com/phetsims/phet-io/issues/1457 that conditional instrumentation only serves to complicate phet-io, I think I'm leaning towards always instrumenting the Property, and updating the documentation to be clear that this is only useful for alternative input. |
I made the focusProperty always instrumented. Note that it is a bit of a pain to need to compute all of the baselines for small changes like this. It takes a few minutes, even with the small number of sims we currently have. Perhaps we could have a @samreid please review. |
af9fe77 broke beers-law-lab in CT:
|
Sorry @pixelzoom, fixes pushed above. @samreid please review. |
This seems the right direction to go in. I fixed a typo and updated formatting. Also, I noted this tandem:
Two points:
|
I do see it there, do you now? It is not featured if that is helpful.
That makes a lot of sense, and sounds futureproof. Sorry I only am seeing this now. Do you think it is still worth it after GQ has been published? |
I see it under "all", thanks! We should schedule time to look at all the elements under general.* and think of how we want to organize them (possibly model|view|controller). Let's leave |
I think that will happen as part of phetsims/tandem#108. Closing |
There is a conditional when creating Display.focusProperty that doesn't account for sims that are enabling a11y by passing an option into
Sim
We need to find a way around this. Right now we have to add
a11y
to BASE in order to instrument this property.The text was updated successfully, but these errors were encountered: