phetsims / sun

User-interface components for PhET simulations, built on top of Scenery.
MIT License
4 stars 12 forks source link

ComboBox does not resize properly when its items have dynamic bounds. #785

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

Related to https://github.com/phetsims/sun/issues/783 ...

ComboBox's button is not resizing properly when its items involve StringProperty. There are multiple problems, enumerated in the example below.

To reproduce in Geometric Optics:

  1. Run the sim, go to Lens screen, open ComboBox at upper-left. Select from the ComboBox listbox. Note that the selected item is left-aligned on the button, and the content part of the button matches the width of the listbox. For example:
screenshot_1839
  1. Cycle through locales. Note that after awhile, there are multiple problems:
    • The button does not shrink to fit the content.
    • The alignment of the content is wrong.
    • The width of the button does not match the listbox.
    • The part of the button used to open the listbox (down arrow) has mysterious blank space to the right of it. This part of the button should never change.

For example:

screenshot_1840
pixelzoom commented 2 years ago

ComboBoxListBox seems to be behaving as expected. The problem is ComboBoxButton.

jonathanolson commented 2 years ago

This looks like it's related to the "button only grows instead of shrinks" issue. I'm looking into it.

jonathanolson commented 2 years ago

In my working copy, I've handled the button issue, however this is still showing up with keyboard navigation:

image
jonathanolson commented 2 years ago

I believe https://github.com/phetsims/sun/issues/781 fixed the main layout work for this. @pixelzoom can you verify, or see if there is anything else that needs to be done?

pixelzoom commented 2 years ago

Reviewed in the context of Geometric Optics combo box. Resize behavior is now as expected, including focus highlight. I did not review code changes. Closing.