Hi Piotr,

So that was the fix for UpperCase bead. Check the code:

protected function changeToUpperCase(event:Event):void
{
COMPILE::JS
{
var input:HTMLInputElement = event.target.input as HTMLInputElement;
var start:Number = input.selectionStart;
var end:Number = input.selectionEnd;
input.value = input.value.toUpperCase();
input.setSelectionRange(start, end);
}
}

you need to get selection start and end positions and then after change
value set the selection again.



El lun., 19 oct. 2020 a las 12:45, Piotr Zarzycki (<
[email protected]>) escribió:

> Carlos,
>
> The summary could be just that sentence which I have put in previous email
> :)
>
> Sentence from article: "Programmatically changing the text field value
> resets its cursor position".
>
> As you can see in my code above I'm changing text programmatically. The use
> case above is actually 2-way binding simulation. Description of code above
> could be:
>
> 1. I'm launching application where TextInput has text = null - nothing is
> being assigned
> 2. I'm typing some text which call event "change" and my event handler is
> being called "onChange"
> 3. In event handler I'm assigning to field "_myVar " what has been typed in
> TextInput
> 4. Because "_myVar" is [Bindable] internal mechanism apply changes to
> TextInput, so binding is doing
>
> myTextInput.text = _myVar
>
> It's like circle - I'm typing something and stuff is getting back to the
> component trough my property.
>
> This use case is a simulation of 2-way binding actually, cause in Royale
> following annotation doesn't work text="@{_myVar}".
>
> Thanks,
> Piotr
>
> pon., 19 paź 2020 o 12:35 Carlos Rovira <[email protected]>
> napisał(a):
>
> > Hi Piotr
> > great you get it! :)
> > Sorry but don't have much time these days to go over the article, can you
> > resume what the problem is?
> > And if it is something in our implementation or is in your own use case?
> > Thanks
> >
> > El lun., 19 oct. 2020 a las 12:27, Piotr Zarzycki (<
> > [email protected]>) escribió:
> >
> > > Carlos,
> > >
> > > I think we are experiencing issue described here [1]. I'm pretty sure
> > this
> > > is it:
> > >
> > > Sentence from article: "Programmatically changing the text field value
> > > resets its cursor position".
> > >
> > > Here is the short code, but I can put it in the simple example:
> > >
> > > [Bindable]
> > > private var _myVar:String;
> > >
> > > private function onChange(event:Event):void
> > > {
> > >      _myVar = event.target.text;
> > > }
> > >
> > > <j:TextInput text="{_myVar}" change="onChange(event)"/>
> > >
> > > Thanks to above code we can reproduce problem in Safari.
> > >
> > > [1]
> > https://www.mutuallyhuman.com/blog/the-curious-case-of-cursor-jumping/
> > >
> > > Thanks,
> > > Piotr
> > >
> > > niedz., 18 paź 2020 o 22:04 Piotr Zarzycki <[email protected]>
> > > napisał(a):
> > >
> > > > Carlos,
> > > >
> > > > There is no bead in TexInput. It's just:
> > > >
> > > > <j:TextInput/>
> > > >
> > > > I cannot reproduce so far that in simple example. I'm in the process
> of
> > > > investigating it farther.
> > > >
> > > > Thanks,
> > > > Piotr
> > > >
> > > > On Sun, Oct 18, 2020, 4:10 PM Carlos Rovira <[email protected]
> >
> > > > wrote:
> > > >
> > > >> Hi Piotr,
> > > >>
> > > >> At the time I checked the problem it was an issue in UpperCase
> bead, I
> > > >> think the same happened to other beads, but don't remember I went
> over
> > > >> those too. I think it is important to isolate beads and see how I
> > solved
> > > >> the problem in UpperCase in order to do the proper changes for the
> > rest
> > > of
> > > >> the beads suffering that issue. I'm these days with an important
> > > workload
> > > >> in other things, so I'll not be able to spend time on royale. I
> think
> > > that
> > > >> could be for 1-2 weeks for now.
> > > >>
> > > >> El sáb., 17 oct. 2020 a las 16:15, Piotr Zarzycki (<
> > > >> [email protected]>) escribió:
> > > >>
> > > >> > Hi Carlos,
> > > >> >
> > > >> > I'm still able to reproduce in our application this issue. I
> really
> > > >> cannot
> > > >> > isolate the problem. The worst thing is that - I have Form, with
> > let's
> > > >> say
> > > >> > 6 text inputs. Some of them experience that isse the other one
> not!
> > > >> >
> > > >> > They are simple TextInputs with one bead TextPrompt. I'm trying to
> > > >> create
> > > >> > simple example, but so far I cannot reproduce that stuff outside
> our
> > > >> > application.
> > > >> >
> > > >> > Thanks,
> > > >> > Piotr
> > > >> >
> > > >> > pt., 14 sie 2020 o 21:59 Carlos Rovira <[email protected]>
> > > >> > napisał(a):
> > > >> >
> > > >> > > Hi Piotr,
> > > >> > >
> > > >> > > I fixed UpperCase bead to work properly. I need to go over other
> > > >> beads,
> > > >> > but
> > > >> > > I think UpperCase shows how to fix the issue in Safari or at
> > least I
> > > >> see
> > > >> > > that TDJ TextInput working ok now. Tomorrow I'll go over other
> > > beads.
> > > >> > >
> > > >> > >
> > > >> > > El jue., 13 ago. 2020 a las 18:17, Carlos Rovira (<
> > > >> > [email protected]
> > > >> > > >)
> > > >> > > escribió:
> > > >> > >
> > > >> > > > Hi Piotr,
> > > >> > > >
> > > >> > > > searching for "safari cursor to the end" I'm seeing the issue
> > > >> reported
> > > >> > in
> > > >> > > > some links. I'm publishing website now and must leave so can't
> > > take
> > > >> a
> > > >> > > look
> > > >> > > > now.
> > > >> > > >
> > > >> > > > Please take a look to see if there's some workaround doing
> some
> > > >> google
> > > >> > > > search, since seems a safari problem that maybe has some
> > > workaround.
> > > >> > > >
> > > >> > > > some links I found:
> > > >> > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> https://stackoverflow.com/questions/61885850/cursor-jumps-to-end-of-input-text-on-safari-browser-ng-select
> > > >> > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> https://stackoverflow.com/questions/55850414/cursor-jumps-to-end-of-field-if-you-attempt-to-edit
> > > >> > > >
> > > >> > > >
> > > >> > > > El jue., 13 ago. 2020 a las 16:02, Piotr Zarzycki (<
> > > >> > > > [email protected]>) escribió:
> > > >> > > >
> > > >> > > >> Hello Guys,
> > > >> > > >>
> > > >> > > >> We have got report from one of our client about really noizy
> > > >> issue. It
> > > >> > > >> occurs only in release build of our application. I'm able to
> > > >> reproduce
> > > >> > > it
> > > >> > > >> in TourDeJewel.
> > > >> > > >> Issue is being reported on Safari 13.1.2 (15609.3.5.1.3).
> > > >> > > >>
> > > >> > > >> Basically when I'm trying to type some text in TextInput in
> the
> > > >> middle
> > > >> > > of
> > > >> > > >> already placed text courser is jumping at the end. Note that
> > only
> > > >> some
> > > >> > > of
> > > >> > > >> the TextInput are affected - you can see that in my gif. [1]
> > > >> > > >>
> > > >> > > >> Anyone have some thoughts on this ?
> > > >> > > >>
> > > >> > > >> [1] https://ibb.co/rk5DyJS
> > > >> > > >>
> > > >> > > >> Thanks,
> > > >> > > >> --
> > > >> > > >>
> > > >> > > >> Piotr Zarzycki
> > > >> > > >>
> > > >> > > >
> > > >> > > >
> > > >> > > > --
> > > >> > > > Carlos Rovira
> > > >> > > > http://about.me/carlosrovira
> > > >> > > >
> > > >> > > >
> > > >> > >
> > > >> > > --
> > > >> > > Carlos Rovira
> > > >> > > http://about.me/carlosrovira
> > > >> > >
> > > >> >
> > > >> >
> > > >> > --
> > > >> >
> > > >> > Piotr Zarzycki
> > > >> >
> > > >>
> > > >>
> > > >> --
> > > >> Carlos Rovira
> > > >> Apache Member & Apache Royale PMC
> > > >> *Apache Software Foundation*
> > > >> http://about.me/carlosrovira
> > > >>
> > > >
> > >
> > > --
> > >
> > > Piotr Zarzycki
> > >
> >
> >
> > --
> > Carlos Rovira
> > Apache Member & Apache Royale PMC
> > *Apache Software Foundation*
> > http://about.me/carlosrovira
> >
>
>
> --
>
> Piotr Zarzycki
>


-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

Reply via email to