I’ve been trying to use selectionStart inside the dcc.Input() but I’m not sure how to make it work according to the documentation. This is my code so far:
app.layout = html.Div([
def update_input(txt_inserted, slct_start)
Nothing seems to happen, and I always get a None type. This example demonstrates how selectionStart is read.
Can someone please explain how selectionStart works inside dcc.Input()
Is there any update on this? I have been trying to get cursor position in input field so I could insert text on that position and I came across selectionStart and selectionEnd properties, but they do not seem to work. I also always get a None type when using them with n_submit or n_blur properties of Input for callback
Decided to start a New Topic since this is a 2-parter and since this thread has been dormant for over a year.
Moving to New Topic:
Supplying selectionStart (or -End) as a callback Input or State only ever gives me the initial value (provided I had set one explicitly in the layout). My code is essentially identical to adamschroeder’s (above).
Also, I ultimately will need to use this functionality in a Textarea also, but I only see this property associated with Input. That seems like an odd asymmetry. It’s arguably even more useful in a Textarea where people might be expected to do more complex editing etc - you know, as I am literally doing as I type this. In fact, my goal is to put some Markdown buttons on my Inputs and Textareas not unlike what is on this very widget.
Thanks a bunch!