phetsims / sun

User-interface components for PhET simulations, built on top of Scenery.
http://scenerystack.org/
MIT License
5 stars 12 forks source link

Non-modal Dialog needed. #882

Closed zepumph closed 6 months ago

zepumph commented 6 months ago

From https://github.com/phetsims/mean-share-and-balance/issues/230, designers have found that a non-modal Dialog is best for a feature in MSAB. Currently, Dialog and Popupable do not support isModal:false as an option.

https://github.com/phetsims/sun/blob/447c2ec4bf220bc22081797443f7bbc7481ba199/js/Popupable.ts#L115

Some paper trail here dates back to 2018 (when Dialog was rewritten). https://github.com/phetsims/joist/issues/293#issuecomment-412606679.

For the MSAB case, they could definitely get away with not using Dialog the class, and just creating their own Node, but it is first worth determining what costs are associated with adding isModal:false to Dialog.

From that previous issue, these four concerns were outlined as current problems with non-modal dialogs:

(2) For screen-specific non-modal dialogs, behavior when switching screens is incorrect. When switching screens, dialogs should disappear along with screen. When returning to a screen, dialogs specific to that screen should be restored. Currently, dialogs remain on the screen regardless of which screen is selected.

(3) Non-modal dialogs should be positionable. They are currently limited to centered on the screen.

(4) Non-modal dialogs should be movable, so that you can interact with other UI components. Their position is currently fixed.

(5) Placement of the close button can overlap with the dialog content. See screenshot below. This problem may not be limited to non-modal dialogs (untested with modal dialogs).

I personally do not think that (4) is necessarily needed (depending on the context), and I wonder if (5) is fixed given our new dynamic layout rewrite of Dialog. The other two seem important to handle.

@pixelzoom, do you mind writing down a couple thoughts about your opinions of this issue. Do you have a recommendation for MSAB as to whether we should just use a one-off node, or try to outfit this feature? That will help us determine how to proceed.

pixelzoom commented 6 months ago

In dev meeting, my input was that https://github.com/phetsims/mean-share-and-balance/issues/230 does not require a non-modal dialog. It's perfectly fine to think of it as a Panel.

zepumph commented 6 months ago

Excellent! We can close this issue once against until we actually need this feature.