Ctrl+Z with caps lock on not working in Chrome

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Ctrl+Z with caps lock on not working in Chrome

Felipe Melo
Hi,
 
I'm facing a problem when I try to undo/redo a text change inside a text area or text input. Both Ctrl+Z and Ctrl+Y aren't working properly when caps lock is on. If I turn off caps lock, it works.

The problem seems to occur only in Chrome. Using Firefox or Safari I did not have any problems. I also tested in two different OS: Windows and Mac (same problem in both).

I'm using Chrome version 60.0.3112.90, Flash Player version 26.0.0.151 and Flex SDK 4.16.0.
 
Does anyone have an idea of how to solve this problem?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
Here’s what you can do to help diagnose the problem:

Set a keyDown event handler on the input and examine the event.charCode. Does it change if caps lock is on or off?

(It should be 122 for z and 121 for y.)

Thanks,
Harbs

> On Aug 9, 2017, at 10:51 PM, Felipe Melo <[hidden email]> wrote:
>
> Hi,
>
> I'm facing a problem when I try to undo/redo a text change inside a text
> area or text input. Both Ctrl+Z and Ctrl+Y aren't working properly when caps
> lock is on. If I turn off caps lock, it works.
>
> The problem seems to occur only in Chrome. Using Firefox or Safari I did not
> have any problems. I also tested in two different OS: Windows and Mac (same
> problem in both).
>
> I'm using Chrome version 60.0.3112.90, Flash Player version 26.0.0.151 and
> Flex SDK 4.16.0.
>
> Does anyone have an idea of how to solve this problem?
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Ctrl-Z-with-caps-lock-on-not-working-in-Chrome-tp15676.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Felipe Melo
Thanks for your reply. I did what you suggested but everything seems fine:

caps lock on: Y=89, Z=90
caps lock off: y=121, z=122

I have already confirmed that is not a problem in my code because I was able to reproduce the problem in the "Text Controls" example running at http://flex.apache.org/tourdeflex/ (Spark Framework Components > Visual Components > Text Controls > Text Controls).

The simple code below also presents the same problem:

<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
    <s:TextArea/>
</s:Application>

Thanks,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
And I assume that in other browsers it’s always 121 and 122. Right?

> On Aug 10, 2017, at 12:20 AM, Felipe Melo <[hidden email]> wrote:
>
> Thanks for your reply. I did what you suggested but everything seems fine:
>
> caps lock on: Y=89, Z=90
> caps lock off: y=121, z=122
>
> I have already confirmed that is not a problem in my code because I was able
> to reproduce the problem in the "Text Controls" example running at
> http://flex.apache.org/tourdeflex/ (Spark Framework Components > Visual
> Components > Text Controls > Text Controls).
>
> The simple code below also presents the same problem:
>
> <?xml version="1.0"?>
> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> xmlns:s="library://ns.adobe.com/flex/spark">
>    <s:TextArea/>
> </s:Application>
>
> Thanks,
>
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Ctrl-Z-with-caps-lock-on-not-working-in-Chrome-tp15676p15678.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
You can try monkey-patching EditManager like so:

                                        switch(event.charCode)
                                        {
                                                case 122: // small z
                                                case 90: // fixed caps lock problem
                                                        /* pre-Argo and on the mac then ignoreNextTextEvent */
                                                        if (!Configuration.versionIsAtLeast(10,1) && (Capabilities.os.search("Mac OS") > -1))
                                                                ignoreNextTextEvent = true;
                                                        if(event.shiftKey){
                                                                redo();
                                                                event.preventDefault();

                                                        } else {
                                                                undo();
                                                                event.preventDefault();
                                                        }
                                                        break;
                                                case 121: // small y
                                                case 89: // fixed caps lock problem
                                                        ignoreNextTextEvent = true;
                                                        redo();
                                                        event.preventDefault();
                                                        break;

> On Aug 10, 2017, at 12:45 AM, Harbs <[hidden email]> wrote:
>
> And I assume that in other browsers it’s always 121 and 122. Right?
>
>> On Aug 10, 2017, at 12:20 AM, Felipe Melo <[hidden email]> wrote:
>>
>> Thanks for your reply. I did what you suggested but everything seems fine:
>>
>> caps lock on: Y=89, Z=90
>> caps lock off: y=121, z=122
>>
>> I have already confirmed that is not a problem in my code because I was able
>> to reproduce the problem in the "Text Controls" example running at
>> http://flex.apache.org/tourdeflex/ (Spark Framework Components > Visual
>> Components > Text Controls > Text Controls).
>>
>> The simple code below also presents the same problem:
>>
>> <?xml version="1.0"?>
>> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> xmlns:s="library://ns.adobe.com/flex/spark">
>>   <s:TextArea/>
>> </s:Application>
>>
>> Thanks,
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Ctrl-Z-with-caps-lock-on-not-working-in-Chrome-tp15676p15678.html
>> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Alex Harui-2
Or just dispatch the desired keyboard event when you see the undesired one.

HTH,
-Alex

On 8/9/17, 2:47 PM, "Harbs" <[hidden email]> wrote:

>You can try monkey-patching EditManager like so:
>
> switch(event.charCode)
> {
> case 122: // small z
> case 90: // fixed caps lock problem
> /* pre-Argo and on the mac then ignoreNextTextEvent */
> if (!Configuration.versionIsAtLeast(10,1) &&
>(Capabilities.os.search("Mac OS") > -1))
> ignoreNextTextEvent = true;
> if(event.shiftKey){
> redo();
> event.preventDefault();
>
> } else {
> undo();
> event.preventDefault();
> }
> break;
> case 121: // small y
> case 89: // fixed caps lock problem
> ignoreNextTextEvent = true;
> redo();
> event.preventDefault();
> break;
>
>> On Aug 10, 2017, at 12:45 AM, Harbs <[hidden email]> wrote:
>>
>> And I assume that in other browsers it’s always 121 and 122. Right?
>>
>>> On Aug 10, 2017, at 12:20 AM, Felipe Melo <[hidden email]> wrote:
>>>
>>> Thanks for your reply. I did what you suggested but everything seems
>>>fine:
>>>
>>> caps lock on: Y=89, Z=90
>>> caps lock off: y=121, z=122
>>>
>>> I have already confirmed that is not a problem in my code because I
>>>was able
>>> to reproduce the problem in the "Text Controls" example running at
>>>
>>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fflex.apa
>>>che.org%2Ftourdeflex%2F&data=02%7C01%7C%7Cb095298bf6d1465f2b3c08d4df7048
>>>24%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636379120716199782&sdata
>>>=EbYU6idsNIoF43URvxwBx6%2BfHQf%2FKHH1wA52kztjeQI%3D&reserved=0 (Spark
>>>Framework Components > Visual
>>> Components > Text Controls > Text Controls).
>>>
>>> The simple code below also presents the same problem:
>>>
>>> <?xml version="1.0"?>
>>> <s:Application
>>>xmlns:fx="<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%
>>>2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7C%7Cb095298bf6d1465f2b3c08d4d
>>>f704824%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636379120716199782&
>>>sdata=10uRSw9WbisF2Uf1sauxU5IHxLRyf9Nv5P7sp%2BzdSkI%3D&reserved=0"
>>> xmlns:s="library://ns.adobe.com/flex/spark">
>>>   <s:TextArea/>
>>> </s:Application>
>>>
>>> Thanks,
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-f
>>>lex-users.2333346.n4.nabble.com%2FCtrl-Z-with-caps-lock-on-not-working-i
>>>n-Chrome-tp15676p15678.html&data=02%7C01%7C%7Cb095298bf6d1465f2b3c08d4df
>>>704824%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636379120716199782&s
>>>data=jWcPFKS%2FBxy2YhMfF8zDuPNUXjSrUTqMJskTkk3vGak%3D&reserved=0
>>> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
Even simpler.

> On Aug 10, 2017, at 1:00 AM, Alex Harui <[hidden email]> wrote:
>
> Or just dispatch the desired keyboard event when you see the undesired one.
>
> HTH,
> -Alex
>
> On 8/9/17, 2:47 PM, "Harbs" <[hidden email] <mailto:[hidden email]>> wrote:
>
>> You can try monkey-patching EditManager like so:
>>
>> switch(event.charCode)
>> {
>> case 122: // small z
>> case 90: // fixed caps lock problem
>> /* pre-Argo and on the mac then ignoreNextTextEvent */
>> if (!Configuration.versionIsAtLeast(10,1) &&
>> (Capabilities.os.search("Mac OS") > -1))
>> ignoreNextTextEvent = true;
>> if(event.shiftKey){
>> redo();
>> event.preventDefault();
>>
>> } else {
>> undo();
>> event.preventDefault();
>> }
>> break;
>> case 121: // small y
>> case 89: // fixed caps lock problem
>> ignoreNextTextEvent = true;
>> redo();
>> event.preventDefault();
>> break;
>>
>>> On Aug 10, 2017, at 12:45 AM, Harbs <[hidden email]> wrote:
>>>
>>> And I assume that in other browsers it’s always 121 and 122. Right?
>>>
>>>> On Aug 10, 2017, at 12:20 AM, Felipe Melo <[hidden email]> wrote:
>>>>
>>>> Thanks for your reply. I did what you suggested but everything seems
>>>> fine:
>>>>
>>>> caps lock on: Y=89, Z=90
>>>> caps lock off: y=121, z=122
>>>>
>>>> I have already confirmed that is not a problem in my code because I
>>>> was able
>>>> to reproduce the problem in the "Text Controls" example running at
>>>>
>>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fflex.apa <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fflex.apa>
>>>> che.org <http://che.org/>%2Ftourdeflex%2F&data=02%7C01%7C%7Cb095298bf6d1465f2b3c08d4df7048
>>>> 24%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636379120716199782&sdata
>>>> =EbYU6idsNIoF43URvxwBx6%2BfHQf%2FKHH1wA52kztjeQI%3D&reserved=0 (Spark
>>>> Framework Components > Visual
>>>> Components > Text Controls > Text Controls).
>>>>
>>>> The simple code below also presents the same problem:
>>>>
>>>> <?xml version="1.0"?>
>>>> <s:Application
>>>> xmlns:fx="<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F% <<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%">https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%>
>>>> 2Fns.adobe.com <http://2fns.adobe.com/>%2Fmxml%2F2009&data=02%7C01%7C%7Cb095298bf6d1465f2b3c08d4d
>>>> f704824%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636379120716199782&
>>>> sdata=10uRSw9WbisF2Uf1sauxU5IHxLRyf9Nv5P7sp%2BzdSkI%3D&reserved=0"
>>>> xmlns:s="library://ns.adobe.com/flex/spark <library://ns.adobe.com/flex/spark>">
>>>>  <s:TextArea/>
>>>> </s:Application>
>>>>
>>>> Thanks,
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-f <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-f>
>>>> lex-users.2333346.n4.nabble.com <http://lex-users.2333346.n4.nabble.com/>%2FCtrl-Z-with-caps-lock-on-not-working-i
>>>> n-Chrome-tp15676p15678.html&data=02%7C01%7C%7Cb095298bf6d1465f2b3c08d4df
>>>> 704824%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636379120716199782&s
>>>> data=jWcPFKS%2FBxy2YhMfF8zDuPNUXjSrUTqMJskTkk3vGak%3D&reserved=0
>>>> Sent from the Apache Flex Users mailing list archive at Nabble.com <http://nabble.com/>.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Felipe Melo
Hi,

I have not tested the EditManager approach, but dispatching a new event with the lower case char code solved the problem. I'm not happy with using this kind of workaround but sometimes it is necessary :)

I just didn't get it why this problem only happens in Chrome, because the char codes in all browsers are the same. At first, I thought that this was a Flash Player problem, but the Adobe staff don't think so.

Anyway, thank you all for helping me.

- Felipe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
The charCodes are not the same.

I just tested in Firefox and it’s 122 with caps lock on.

The Chrome Flash plugin is different and it’s probably dispatching different events.

> On Aug 10, 2017, at 5:35 PM, Felipe Melo <[hidden email]> wrote:
>
> Hi,
>
> I have not tested the EditManager approach, but dispatching a new event with
> the lower case char code solved the problem. I'm not happy with using this
> kind of workaround but sometimes it is necessary :)
>
> I just didn't get it why this problem only happens in Chrome, because the
> char codes in all browsers are the same. At first, I thought that this was a
> Flash Player problem, but the Adobe staff don't think so.
>
> Anyway, thank you all for helping me.
>
> - Felipe
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Ctrl-Z-with-caps-lock-on-not-working-in-Chrome-tp15676p15693.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
I’m not sure if this is something that should be fixed on Adobe’s end. If they don’t want to fix it, we can change EditManager to accept both charCodes to deal with the difference in Chrome.

Let us know what you hear back from Adobe and create a JIRA if necessary. https://issues.apache.org/jira/browse/FLEX

Thanks,
Harbs

> On Aug 10, 2017, at 5:54 PM, Harbs <[hidden email]> wrote:
>
> The charCodes are not the same.
>
> I just tested in Firefox and it’s 122 with caps lock on.
>
> The Chrome Flash plugin is different and it’s probably dispatching different events.
>
>> On Aug 10, 2017, at 5:35 PM, Felipe Melo <[hidden email]> wrote:
>>
>> Hi,
>>
>> I have not tested the EditManager approach, but dispatching a new event with
>> the lower case char code solved the problem. I'm not happy with using this
>> kind of workaround but sometimes it is necessary :)
>>
>> I just didn't get it why this problem only happens in Chrome, because the
>> char codes in all browsers are the same. At first, I thought that this was a
>> Flash Player problem, but the Adobe staff don't think so.
>>
>> Anyway, thank you all for helping me.
>>
>> - Felipe
>>
>>
>>
>> --
>> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Ctrl-Z-with-caps-lock-on-not-working-in-Chrome-tp15676p15693.html
>> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Felipe Melo
In reply to this post by Harbs
No, I meant that for all browsers the charCode of 'z' will be 122 and 'Z' will be 90. Chrome doesn't display any different value.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Felipe Melo
I'm sorry, I think my last message was still confusing. In Chrome, the charCode of 'z' is 122 and 'Z' is 90, like the other browsers.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Harbs
Sure. But when you press the key z with capslock and command/control, the charCode is for the little z rather than the big one. (Or at least it is in all browsers other than Chrome.)

Clearer?

> On Aug 10, 2017, at 7:25 PM, Felipe Melo <[hidden email]> wrote:
>
> I'm sorry, I think my last message was still confusing. In Chrome, the
> charCode of 'z' is 122 and 'Z' is 90, like the other browsers.
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Ctrl-Z-with-caps-lock-on-not-working-in-Chrome-tp15676p15701.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Ctrl+Z with caps lock on not working in Chrome

Felipe Melo
Yes, you're right. Everything is fine except when Ctrl/Cmd is pressed.

On Thu, Aug 10, 2017 at 2:06 PM Harbs [via Apache Flex Users] <[hidden email]> wrote:
Sure. But when you press the key z with capslock and command/control, the charCode is for the little z rather than the big one. (Or at least it is in all browsers other than Chrome.)

Clearer?

> On Aug 10, 2017, at 7:25 PM, Felipe Melo <[hidden email]> wrote:
>
> I'm sorry, I think my last message was still confusing. In Chrome, the
> charCode of 'z' is 122 and 'Z' is 90, like the other browsers.
>
>
>

> Sent from the Apache Flex Users mailing list archive at Nabble.com.
If you reply to this email, your message will be added to the discussion below:
To unsubscribe from Ctrl+Z with caps lock on not working in Chrome, click here.
NAML
Loading...