[Ur] <ctextinput source={s} /> looses input focus after every keypress

Adam Chlipala adamc at csail.mit.edu
Mon Apr 3 09:50:19 EDT 2017


Yeah, sounds like there's no easy solution, unless you realize that the 
<dyn> dependency is spurious.  You could try breaking it into multiple 
smaller <dyn>s, maybe with some nested inside of others.

On 04/03/2017 09:33 AM, Sergey Mironov wrote:
> Hm! The original code is sketched below. I am not interested in
> catching every event from <ctextbox> but the code expresses exactly
> this, so you are right, Thanks!
>
>
> Regards,
> Sergey
>
> PS by ctextinput I meant ctextbox
>
> fun editable (t:string) (upd:string->transaction unit) =
>    <xml><active code={
>       st <- source t;
>       se <- source False; (*edit mode*)
>
>       ...
>
>       return <xml>
>         <dyn signal={
>           t <- signal st;
>           e <- signal se;
>
>           return
>           <xml>
>
>            <ctextbox signal={t} onkeypress={... v <- get t; rpc(upd v); ... } />
>
>            </xml>
>
>         }/>
>       </xml>
>     }/>
>     </xml>
>
> 2017-04-03 15:02 GMT+03:00 Adam Chlipala <adamc at csail.mit.edu>:
>> Is the control inside a <dyn> whose value is affected by a source that every
>> keypress updates? Focus is expected to go away every time a dynamic subtree
>> needs to be rebuilt.
>>
>> On 04/03/2017 06:38 AM, Sergey Mironov wrote:
>>> Just found a strange issue regarding <ctextinput>. If used with
>>> source={s} attribute set, the control looses input focus after every
>>> keypress event. Removing source={s} brings back the correct behavior.
>>> Is it a known issue?
>>>
>>> As a workaround, I tried <ctextinput id={cid} source={s}
>>> onkeypress={fn _ => giveFocus cid} /> with no improvement.
>>>
>>> I'm using urweb-20170105 and firefox(nighty)-49.0
>>
>> _______________________________________________
>> Ur mailing list
>> Ur at impredicative.com
>> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur




More information about the Ur mailing list