-
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
ComboBox listbox does not resize when last item is made invisible #588
Comments
It would be best for @jonathanolson to answer these questions, unassigning for now. Please reassign me if I should assist. |
This is not related to the selected item, it's related to the last item in the list.
|
If the combo selection is changed in either of the above 2 scenarios, then the listbox resizes to eliminate the gap where 'Water' was. |
…undsDirty with our call, so child bounds were not being correctly recomputed in some cases. See phetsims/sun#588, phetsims/joist#608
The above fix looks good, verified in ph-scale. But to clarify... There are 2 problems to address here: (1) is fixed. Should we do anything about (2)? Adding @samreid and @arouinfar for their opinion. To summarize, the remaining question is whether it's OK that the selected item does not appear in the list. It seems very odd to me, but I don't have a proposal for addressing it. And it doesn't seem to cause a problem. |
Also adding @jessegreenberg for an a11y perspective, in case there's an issue that I'm not aware of. Please see summary in previous comment. |
It may be acceptable if this happens during customization in studio. However, what if a client develops a wrapper that removes a UI component that has focus or is being used? |
Given that iO provides access to potentially any Node, I would hope that scenery's input system would interrupt any interaction that is in progress when the target Node becomes invisible. @jonathanolson is that the case? |
It seems problematic to me as well. I think it would be best to not allow the selected item to be removed from the list (if possible). But if this behavior sticks around we will want to support it with keyboard focus. ComboBoxListBox puts focus on the selected item when opened, which cannot happen if the item isn't in the list. |
Hmmm... This is going to be tricky. The |
Currently no visibility listeners are added, although this would be possible to implement (interaction with a target node temporarily adds a listener so that if visibility is toggled to false it interrupts). I could imagine cases where we could be doing this unintentionally, but that's unlikely and could be worked around. Thoughts on adding that feature to PressListener? |
It also seems a bit odd to me, but I think it is acceptable since it doesn't break the sim or cause it to crash. PhET-iO is not foolproof, and there are myriad ways that clients can screw things up when customizing a sim. Our stance so far has been to put the burden on the client, and I don't really see how this case is any different. |
I've moved the remaining question to #591. Closing this issue. |
Over in phetsims/joist#608, option
excludeInvisibleChildrenFromBounds
was added to LayoutBox, and the default was set totrue
. This makes LayoutBox effectively resize when the visibility of children change.The first usage of this was in ComboBox, where the listbox changes size. Apparently this was not tested for the case where the list item is the selected item. In that case, the listbox does not resize. An example occurs in ph-scale. Steps to reproduce and screenshot below.
Steps:
visibleProperty
tofalse
forphScale.macroScreen.view.soluteComboBox.listBox.water.visibleProperty
.Assigning to @samreid and @jonathanolson, since they worked on this feature. High priority, since this impacts all sims with a ComboBox, including sims that are about to be published (e.g. ph-scale, ph-scale-basics).
The text was updated successfully, but these errors were encountered: