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

Create EditableNumberDisplay #678

Open
Tracked by #283
pixelzoom opened this issue Jun 14, 2021 · 5 comments
Open
Tracked by #283

Create EditableNumberDisplay #678

pixelzoom opened this issue Jun 14, 2021 · 5 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Jun 14, 2021

In Fourier, I added sim-specific support to NumberDisplay, to open a Keypad that can be used to enter a specific amplitude value. In phetsims/fourier-making-waves#53, we decided NOT to support Alternative Input for these NumberDisplays. This resulted in a general discussion about input support for NumberDisplay. It sounds like having a optional input (with Keypad?) for NumberDisplay could be generally useful.

Here are the relevant comments from phetsims/fourier-making-waves#53:

In phetsims/fourier-making-waves#53 (comment), @terracoda said:

I am not sure if NumberDisplay is the same component as I've seen in the Arithmetic simulation, but I think it might be. I think it is an interface component that allows a learner to touch or click numbers in order to enter values into a textbox in the sim.

I agree if a learner can get to those discrete values right on the slider using the keyboard (or some alternative input method), they do not need to have access to the NumberDisplay component. That just needs to be made clear in the Teacher Tips for the sim. Making that clear will help all learners. Mouse users might switch to using the keyboard when they need a precise number. I think of NumberDisplay as an accessibility feature for learners using mouse and touch who would otherwise have a hard time entering exact values.

In the future, should we want to make NumberDisplay available to other input methods, I think it would make sense that the component is a navigable region or group, that is thoughtfully designed to not exponentially increase the number of Tab stops in the PDOM.

I replied:

NumberDisplay is a display only. It is not interactive, has no support for any kind of input. In Fourier, I've added a mouse/touch listener (PressListener) that open a keypad. There is currently no support for this in common-code, and it must be done on a sim-specific basic. Adding keyboard support to open a keypad would involve more sim-specific work, as described in phetsims/fourier-making-waves#53 (comment):

NumberDisplay does not support keyboard input. We’d probably need to identify as 'button', and add an onclick handler.

I do not think that input support should be added to NumberDisplay - it is useful to have a UI component that is a display only, without the overhead of input handling. I do think it would be useful to have a common-code subclass of NumberDisplay that adds support for opening a keypad. But there is currently no proposal or GitHub issue for such a component.

And a bit later, I added:

Thinking about this more, I've changed my mind - an option to NumberDisplay would be preferrable to a subclass. NumberDisplay is (or should be) used as a subcomponet on many other UI components: NumberControl, NumberSpinner,... It would be nice to have keypad entry as an option for those controls, probably via the nested numberDisplayOptions. And making keypad entry an option to NumberDisplay would make that easier. Having to choose between NumberDisplay and (e.g.) InteractiveNumberDisplay would be more complicated programmng, and make it more difficult to mutate this feature (turn if on and off), which is something that I suspect would be desirable via PhET-iO.

@marlitas
Copy link
Contributor

marlitas commented Mar 6, 2024

Meeting 4/6/24

  • @zepumph felt that adding this functionality directly to Number Display would not be the most PhET-like experience. For example the keypad layer provides the range text for us. So to him it doesn't seem too easy to just add directly to NumberDisplay.
  • The next steps for this issues is to create an EditableNumberDisplay that would use composition allowing us to scaffold keypad access through alt-input.

@jessegreenberg
Copy link
Contributor

The scenery issue to add native text/number input support is phetsims/scenery#670.

@pixelzoom
Copy link
Contributor Author

I recommend against adding anything new to NumberDisplay -- or building a new subclass on top of it! See #828 (Next-generation version of NumberDisplay is needed).

@zepumph
Copy link
Member

zepumph commented Mar 6, 2024

Righto, we are also talking about the need to not hard code this solution to the current NumberDisplay.

@zepumph
Copy link
Member

zepumph commented Mar 6, 2024

For this issue, we want it to focus our "workaround", which is the number display + keypad common code component (currently used in Fourier and MSS). See phetsims/scenery#670 for actual keyboard support for typing in numbers for the NumberDisplay.

@zepumph zepumph changed the title Optional input handling for NumberDisplay Create EditableNumberDisplay Mar 6, 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

5 participants