Skip to content
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 "display mode" to ComboBox #451

Open
Tracked by #922
pixelzoom opened this issue Jan 17, 2019 · 11 comments
Open
Tracked by #922

Add "display mode" to ComboBox #451

pixelzoom opened this issue Jan 17, 2019 · 11 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

1/17/19 phet-io meeting, requested by @kathy-phet:

Add {BooleanProperty} singleItemDisplayProperty, default false. Hides the arrow and vertical separator on the ComboBoxButton, and set's pickable: false on the ComboBox.

@pixelzoom pixelzoom self-assigned this Jan 17, 2019
@pixelzoom
Copy link
Contributor Author

This will involve instrumenting ComboBoxButton, which is currently not implemented.

pixelzoom added a commit that referenced this issue Jan 17, 2019
Signed-off-by: Chris Malley <[email protected]>
pixelzoom added a commit that referenced this issue Jan 17, 2019
@pixelzoom
Copy link
Contributor Author

Implemented in the above commits.

While implementing this, I decided that displayOnlyProperty was a better name. Here it is in ComboBoxButton:

      this.displayOnlyProperty = new BooleanProperty( false, {
        tandem: options.tandem.createTandem( 'displayOnlyProperty' ),
        phetioDocumentation: 'disables interaction with the ComboBox and makes it appear like value display'
      } );

Here's how it looks in Studio with Beer's Law Lab. First with false (the normal state):

screenshot_962

Here's how it looks where set to true. The arrow and vertical separator are hidden, and the combo box is not interactive.

screenshot_961

@ariel-phet please assigning someone to review.

@pixelzoom pixelzoom assigned ariel-phet and unassigned pixelzoom Jan 17, 2019
pixelzoom added a commit that referenced this issue Jan 17, 2019
Signed-off-by: Chris Malley <[email protected]>
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jan 17, 2019

phetioDocumentation was revised to:

phetioDocumentation: 'disables interaction with the ComboBox button ' +
                     'and makes it appear like a display that shows the current selection'

pixelzoom added a commit that referenced this issue Jan 17, 2019
Signed-off-by: Chris Malley <[email protected]>
samreid added a commit to phetsims/molarity that referenced this issue Jan 17, 2019
samreid added a commit to phetsims/tandem that referenced this issue Jan 17, 2019
samreid added a commit that referenced this issue Jan 17, 2019
samreid added a commit that referenced this issue Jan 17, 2019
@samreid
Copy link
Member

samreid commented Jan 17, 2019

@chrisklus and I reviewed and it looks great, we made minor modifications above. Back to @pixelzoom to sign off on the minor changes. Close if all is well.

@samreid samreid assigned pixelzoom and unassigned ariel-phet Jan 17, 2019
@pixelzoom
Copy link
Contributor Author

👍

@samreid FYI, it looks like a bunch of commit above are for some other issue with title "Remove whitespace from tandem strings". Up to you whether to tag those commits with the correct issue number.

Closing.

@pixelzoom
Copy link
Contributor Author

Reopening. I think this Property may be misplaced. It should probably be a Property of ComboBox, not ComboBoxButton. And in addition to changing the look of ComboBoxButton, it should hide the listBox.

@samreid your opinion?

@samreid
Copy link
Member

samreid commented Jan 20, 2019

I agree with your recommendations. @zepumph does that sound right to you? I recall we discussed whether this property should be in ComboBoxButton or ComboBox, but I don't recall our reasoning.

@pixelzoom
Copy link
Contributor Author

displayOnlyProperty has been moved from ComboBoxButton to ComboBox. Please re-review.

Here's how it looks in Studio with Beer's Law Lab when set to false (normal ComboBox operation):

screenshot_1002

Here's how it looks where set to true. Note that the listbox has been hidden, the button's arrow and vertical separator are hidden, and the entire ComboBox is pickable:false.

screenshot_1003

@pixelzoom pixelzoom removed their assignment Jan 21, 2019
@zepumph
Copy link
Member

zepumph commented Jan 24, 2019

Everything looks good to me. I like putting it directly on the ComboBox.

I wasn't quite sure why we aren't resetting this property on reset? It makes sense to me why we may think that it is nice to not reset so that a client doesn't have to invoke a call again on reset to turn the combo box to display mode. I am worried that this is a new convention, that we don't do anywhere else in the project. Currently our "solution" is explained at the bottom of the wrapper index:

Simulation "Reset All" buttons can overwrite certain kinds of customizations when restoring the simulation to its initial state. If you don't need the Reset All button, then you can hide it using the API with NodeIO.visibleProperty.setValue(). If the ResetAllButton is made invisible, invoking customizations on the simulation in the Client.onSimInitialized() listener is enough. Otherwise, you will need to add a listener to the Reset All button to apply the customizations on the button fire event. This can also be done successfully in Client.onSimInitialized(). Note that it is recommended that you add Client callbacks (like onSimInitialized and onPhetioInitialized) from the launchSim options.

While this isn't the greatest solution, it is general. I would recommend making displayOnlyProperty reset with the rest of combo box. If there are disagreements about this, then I think we should open another issue to discuss this topic in general. Referencing https://github.com/phetsims/phet-io/issues/584 here is probably worth while too.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jan 24, 2019

Zoom discussion with @zepumph and @samreid:

displayOnlyProperty is not part of the user experience, it's not something that the user can change, and it therefore shouldn't be changeable via Reset All.

There's no advantage to wiring displayOnlyProperty into Reset All, although that would work OK since the PhET-iO wrapper client uses the customization callback is used on startup and Reset All. In order to wire displayOnlyProperty into Reset All, we'd need to add a reset method to all UI components between the ResetAllButton and the ComboBox.

This is the same policy that we've had for many years for (e.g.) customizing text elements - they do not reset on Reset All.

So in general, Properties that exist solely for PhET-iO customization should not be wired into Reset All. Assigning to @zepumph to make a note about this in PhET-iO Instrumentation doc. Then please close this issue.

@zepumph
Copy link
Member

zepumph commented Dec 13, 2024

Over in #914, @samreid and I realized that this "displayOnly" characteristic was not implemented with respect to the PDOM.

@zepumph zepumph reopened this Dec 13, 2024
zepumph added a commit that referenced this issue Dec 13, 2024
@zepumph zepumph assigned samreid and unassigned zepumph Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants