-
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
ComboBoxListBox scaling can be buggy with long strings #542
Comments
Above is the workaround commit that worked for molarity, but not for beers-law-lab. |
I'll have a look, but can't get to this until next week. That workaround in phetsims/molarity@244e74e really doesn't look like something that should be committed to the production version of ComboBox. |
OK, now that I'm not trying to look at this on my phone, I see that phetsims/molarity@244e74e is specific to MolarityScreenView, so won't affect other sims. |
After backing out phetsims/molarity@244e74e, I can reproduce in Molarity with |
In Beer's Law Lab with In the Beer's Law screen (either immediately after starting the sim, or after testing Concentration screen), on the 1st click the listbox opens in the wrong position and is scaled incorrectly. On >= 2nd click, the position and scaling are correct. |
About BLL, @zepumph said:
I suspect that you many have been removing it from the listbox parent for the wrong screen. There are 2 screens in this sim, each with its own listbox parent. If I remove |
So here's what's going on... First of all, the listbox parent shouldn't be setting When a I don't know why this problem sorts itself out after the listbox is opened N+ times. And I suspect that this is a new problem because of the total rewrite of ComboBox and its subcomponents. The listbox is scaled in What I recommend is to examine listbox parents in other sims, identify the ones that are setting |
Regular expression |
Molarity is already tracked in phetsims/molarity#152. We can decide what to do with these when the sims are next republished. Unassigning @ariel-phet. |
@zepumph anything else to do here? |
Btw... I did investigate whether ComboBox |
@pixelzoom do you think that an asssertion in ComboBox could be warranted and helpful? // added for https://github.com/phetsims/sun/issues/542
assert && assert( listParent.maxWidth === null, 'listBox scaling handles i18n. Setting maxWidth is buggy' ); |
That would be fine, and would catch other cases that I may have missed via manual inspection. But note that there are other ways in which the listbox parent might be scaled that could cause similar buggy behavior. And since this problem is not specific to i18n, I'd make the assertion message something like:
I would have added the assertion now, but I can't stick around to monitor CT. If you want to add it, go for it. Otherwise I'll add it sometime late next week. |
I've added the recommended assertion in the above commit, and I'll monitor CT. |
Looks OK in CT. @zepumph anything else here? Feel free to close. |
This is the general issue from initial investigation over in phetsims/molarity#152.
@twant and I found that when combobox item lengths cause scaling to occur in the combobox button, the
Combobox.scaleListBox()
function doesn't work 100% of the time. It may be easiest to describe this in terms of examples:Molarity
When using
stringTest=long
, the listbox would be scaled wrong and as a result themoveListBox
function wouldn't work either (it is called right afterwards). See phetsims/molarity#152 (comment)In this case, we were able to fix it by removing the
maxWidth
on thelistBox
parent. We still don't know the underlying cause. Another way that we could solve this, was by adding amaxWidth
to each Text passed to aComboBoxItem
. We elected against that though.States of Matter
The ComboBox in states of matter isn't effectedby this bug. We thought that it was because the ComboBoxItem Text has a
maxWidth
(a solution for Molarity), but alas changing that doesn't matter, even when we set a maxWidth to theComboBox
.Beers Law Lab
In this sim, we also get the bug (try
stringTest=long
), but this time, removing the maxWidth from the listBox parent did not solve things.@twant also noted that in dev versions before the major ComboBox overhaul last winter, this bug was not present. Assigning to @pixelzoom to see if he has any ideas or wants to collaborate on this.
The text was updated successfully, but these errors were encountered: