Closed luisvasq closed 3 days ago
@connor-makowski @luisvasq @mrkwanzaa, here are some libraries for virtual keyboards:
We should also attach a numerical key pad to this issue.
@brianzheng205 those both look pretty solid with no additional deps added. It looks like Simple Keyboard has a lot more support (updated 2 days ago vs years ago).
At first glance, it seems to me that Simple Keyboard would work better for us. I see they have native support for React unlike KioskBoard. I also notice some cool features like changing the layout in terms of language and supporting key customization, which would allow for a single numeric keypad for numeric input.
Just a quick follow up here. I am expecting this to be launched from the input box in the props (num props = number pad and text / combobox props = full keyboard).
I think we may end up emulating the IOS keyboard and this should appear as a draggable that can be exited and opened from the settings pane.
We may even want to add a button to jump between keyboard and number pad in the component in order to generalize the draggable pad.
But if launched from a component, we should switch to the relevant input type on open and allow the user to switch if desired. We should think about the ui/ux on click away.
Makes sense to me. My first thought on the click away UX would be to tie the display/hide of the keyboard to the focus of the input prop (combobox
, text
, num
), unless the switch on the Settings pane is on, in which case the keyboard draggable should remain on display.
Do we want to detect touch events (vs mouse click) and only open the keyboard if a touch caused the focus? Otherwise I'm thinking we'll want an option to never open the keyboard for non-touch users.
Or maybe, the switch button on the Settings pane could set the on-focus behavior for displaying the keyboard, meaning it would always always appear on the respective input when focused if the setting is on, or it would be launchable from an end adornment when the setting is off or if the user closed the keyboard.
I agree that it'd be best to at least set the setting on or off on the Settings pane, depending on whether it's a touch device or not.
I like where this is going from a UI/UX perspective. The auto launch for touch inputs is a great feature (that should be toggleable). I am thinking no matter how we frame this one, we will want a special icon somewhere in the input line for the prop to open this if it is not open.
@connor-makowski @luisvasq I have implemented the bulk of the keyboard and would love your feedbacks on functionality and styling.
Looking good. For the number pad, what does enter
do?
Also can you merge in changes from 2.3.0-dev into your current branch so you can test this with new variants like the incslider
? You will need to pull in changes to cave_app
to get this as well.
enter
does not do anything for any of the inputs. It doesn't seem that typing enter
on a physical keyboard does anything either except for a multiline text input which adds a new line, which the virtual keyboard does not do. I will go ahead and pull changes from 2.3.0-dev.
@connor-makowski How can I add an incslider
to one of the Python scripts in cave_app to test it?
If you pull the most recent cave app (2.3.0-dev) the examples are already updated with incslider examples.
Regarding enter
, we may just want to remove it. Any strong reasons why not?
Looking good!!! I agree that enter
might not be necessary. However, what if we want to add a new line to a textarea
variant as @brianzheng205 pointed out (although it's not currently working for this variant
)? In case we decide to keep it, we could also use it as a blur / focus-out event trigger.
Great job handling auto-display on touchscreen devices! I noticed that the kb launcher is not currently enabled for the slider
's number input and may not be necessary since we already have spin buttons. @connor-makowski should we still have it there?
So for enter, I like the idea of unfocus (submit the input).
For the slider, I would much prefer the keyboard to the spin buttons.
I replaced the Input
in the Numeric Slider with a NumberInput
component since I already implemented numeric inputs for NumberInput
so now the keyboard can also be used for Numeric Sliders. The Incremental Slider does not come with any inputs to change the value. Would you like me to add a NumberInput
component with it as well so that users can type to change the value?
Great, @brianzheng205!! Let's hold off on 'incslider'
for now. Is it possible to add a new line to a textarea
with enter
or a combination of shift
+ enter
, whichever is easier?
@luisvasq I think it should be possible because I think I can figure out a way to distinguish between a text
and textarea
. Would using shift
+ enter
make more sense so that textarea
can keep the ability to press enter
to unfocus the input?
Awesome!
@luisvasq I think it should be possible because I think I can figure out a way to distinguish between a
text
andtextarea
.
Also, that's a great point. Let's keep enter
for unfocus and use shift
+ enter
for a new line.
I decided to go with new line on enter for TextArea when the keyboard is in shift
mode and have the enter
text turn into new line
in shift
mode so it's clearer when the enter
button will add a new line vs unfocusing. This means users do not necessarily need to shift
+ enter
, they just need to press enter (labeled as new line
) while in shift
mode (can be accessed using shift
or caps
).
Good call. :+1: I agree that the new label for the text area is clearer in shift
mode. I see that caps
emulates the same behavior as shift
. I'm wondering if we should enable only uppercase letters when caps
is "on" while keeping the rest of the keyboard unchanged. Also, I guess we might switch back to lowercase letters when both shift
and caps
are on. @connor-makowski, how do you feel about this approach?
@connor-makowski, logging this feature to keep track of it since you mentioned it a few weeks ago as a long-term feature.