focus=yes in edit widget causes input to be selected

48 views
Skip to first unread message

Xavier Cazin

unread,
Jan 27, 2020, 11:51:03 AM1/27/20
to tiddl...@googlegroups.com
Hello everyone,

I stumble on an issue that I can seem to solve by myself: in the code below, I need to set focus=yes to counter the lost of focus caused by the <$set> content refresh :

<$set name=foo value=<<now format:"[UTC]YYYY-0MM-0DD@0hh:0mm:0ss">> >

Refresh of the `foo` value: ''<<foo>>'' causes either //focus// or //user input// (when `focus=yes`) to be lost.

<$edit-text tiddler="$:/state/foo" focus=yes tag=input placeholder="Try typing something" default=""/>
</$set>

But then the input text gets selected as it is typed, causing the next character to replace the previous one. Tested on 5.1.21 and 5.1.22-prerelease, on Firefox and Chrome. How would you solve this?

Thanks in advance for your help!

-- Xavier Cazin

Jeremy Ruston

unread,
Jan 27, 2020, 1:08:32 PM1/27/20
to TiddlyWiki
Hi Xavier

I think this is the venerable problem of the focus/selection not being retained over a refresh cycle. The only way to avoid it at present is to ensure that the edit-text widget doesn’t get refreshed.

Best wishes

Jeremy.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CADeSwYPUwP2jm1-aynHhaNtRSXttL%3DD6y9xWbVEUc75eWYSgQA%40mail.gmail.com.

Xavier Cazin

unread,
Jan 27, 2020, 4:36:11 PM1/27/20
to tiddl...@googlegroups.com
Hi Jeremy,

Thank you for your answer: it lead me to switch to a more idiomatic code for the UI, which wouldn't trigger the edit-text refresh!

Cheers,
-- Xavier Cazin


Reply all
Reply to author
Forward
0 new messages