fluid-lab / gamepad-navigator

GSoC 2020 project
Other
6 stars 10 forks source link

Can't control number inputs. #134

Closed duhrer closed 5 months ago

duhrer commented 6 months ago

Our simulated arrows don't work for number inputs (i.e. <input type="number">).

We should add special casing to the sendKey method to detect that type and use the stepDown and stepUp methods available for that type of form input.

duhrer commented 6 months ago

The basic approach works, but doesn't yet seem to trigger a change that tools like UIO can respond to.

duhrer commented 6 months ago

I switched from using jQuery to dispatching a proper event, and it works.

duhrer commented 6 months ago

Thinking it through, I think it would be most consistent to add a number input helper as a modal, similar to the text editing and select operator. The modal would:

  1. open when a number input is clicked (in the content utils click function).
  2. display but not allow editing of the value directly.
  3. Support max, min, step, and any other parameters of the underlying form input.
  4. Allow arrows to increase and decrease the value.
  5. Have plus and minus buttons on the side that can be operated with tab navigation and clicks.

I'm considering using our standard range input instead, but need to think through a few things.

duhrer commented 6 months ago

I think an onscreen keyboard with a number pad is the way to go, with increment/decrement controls and arrows.

That way large numbers (like years) are also fairly easy to enter.

duhrer commented 6 months ago

I encountered a number input on Weavly that uses an input type of text and an inputmode of decimal. I added one of these to my test harness, and didn't see any problems with using the onscreen keyboard to set a value. However, my current approach doesn't work on the number input (for loop iterations) on Weavly, and I'd like to understand why.