Highlighted

StageWebView problem with Backspace on Windows

Explorer ,
Aug 27, 2016

Copy link to clipboard

Copied

Hi, I have a problem with StageWebView on Windows.

When I add a keydown listener to the html window or document object, it will not dispatch the event for the backspace. All other keys are working and this occurs only on Windows. Is this a bug or the expected behaviour? How can I detect a backspace keydown if it's the default behaviour?

I'm using StageWebView with the flag useNative=true.

Thanks, Solano

TOPICS
Development

Views

568

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

StageWebView problem with Backspace on Windows

Explorer ,
Aug 27, 2016

Copy link to clipboard

Copied

Hi, I have a problem with StageWebView on Windows.

When I add a keydown listener to the html window or document object, it will not dispatch the event for the backspace. All other keys are working and this occurs only on Windows. Is this a bug or the expected behaviour? How can I detect a backspace keydown if it's the default behaviour?

I'm using StageWebView with the flag useNative=true.

Thanks, Solano

TOPICS
Development

Views

569

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 27, 2016 0
Explorer ,
Aug 29, 2016

Copy link to clipboard

Copied

Nobody?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 29, 2016 0
Engaged ,
Aug 30, 2016

Copy link to clipboard

Copied

What version of AIR and Windows are you using? Since you are using the "useNative=true" option, StageWebView should technically be trying to render using the OSes natively installed browsers rendering engine. With Windows that will either be IE or Edge depending on which version of Windows you are using. Doing a quick search on "internet explorer javascript backspace keydown" yields results on issues with detecting key presses for special characters in IE that you have to make considerations for.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2016 0
Explorer ,
Aug 30, 2016

Copy link to clipboard

Copied

wadedwalker​, Thank you for your response.

I made a very simple app and tested it with AIR 19, 20 and 22 on Windows 7, 8 and 10. So basically the html runs with the browsers IE10, 11 and Edge. The javascript works fine when I open the html directly in the browser and the backspace dispatches the event. But inside the AIR app the backspace won't dispatch the event, all other keys are working like expected.

This is the test html:

<html>
<head></head>
<body>
     Some text...
     <script>
          document.onkeydown = function(e)
          {
               e = e || window.event;
               alert('key down: '+e.keyCode);
          }
     </script>
</body>
</html>

I think it has something to do how Air invokes or instantiates the native browser. Maybe there is some bug and I wanted to know if somebody already faced this problem.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2016 0
Engaged ,
Aug 30, 2016

Copy link to clipboard

Copied

It sounds like you have been thoroughly testing this and I feel like I wasted your time. I'm sorry I didn't have a helpful response for you. A few questions/ideas for you to try if you haven't already. Have you tried using "useNative=false" so that it will use the built-in Webkit (the one used by HTMLLoader) to see if it has the same result? Also, can you have the StageWebView(useNative=true) go to website that displays your user agent to confirm that it is using the IE UA? I thought I remember reading someone else on these forums semi-recently having an issue that StageWebView(true) wasn't working as expected on Windows. Last question, what were you using the backspace detection for?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2016 0
Explorer ,
Aug 31, 2016

Copy link to clipboard

Copied

wadedwalker​, You didn't waste my time, it's always good to get some ideias from other peoples and in fact your latest suggestions were pretty good. I didn't try it with the built-in Webkit until yet.

So, it works with the built-in Webkit, but unfortunately I can't use it, because of the lack of some HTML5 features. I should explain what I'm trying to get done. I have to implement an wysiwyg editor inside an Air app and the best choice is to run an existent editor like TinyMCE or CKEditor. All tested editor frameworks, like TinyMCE, dispatches events when the content changes, but they don't really work well. Sometimes they won't either notice that the hole content was replaced by a simple paste action. For this reason I decided to check the content with every pressed key, but on Windows the backspace is simply ignored and no event is dispatched. On the other side, and this is very strange, the editor itself knows that the backspace was pressed and renders the updated content correctly. I'm really confused about this. When you use use an editor like TinyMCE, the content you see and edit isn't inside a textarea, it is in fact inside an div which resides inside an iFrame. Each pressed key is captured and processed by the editor, which will render the content. How are they capturing those events? Writing this i got an idea. Coming back soon...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 31, 2016 0
Explorer ,
Aug 31, 2016

Copy link to clipboard

Copied

So, I thought that it could work if I listen to the key event of a textarea, but unfortunately this didn't work too. I think it's a bug on StageWebViews implementation and therefore I submitted a bug here: Bug#4185700 - StageWebView not firing backspace key event on Windows

I really hope it's something that will get fixed as soon as possible.

Thanks, Solano

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 31, 2016 0
Engaged ,
Aug 31, 2016

Copy link to clipboard

Copied

I don't have a Windows machine to test with, but one thought I had was testing for the "oninput" JS event for the textarea (or div with contenteditable="true"). In the browser, it was firing an alert for each keypress and backspace press. When testing on an <input> element, I alert the value of the input when "oninput" is fired and it is alerting out the new value of the input after the change.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 31, 2016 0
Explorer ,
Aug 31, 2016

Copy link to clipboard

Copied

Just tested your suggestion. Unfortunately this didn't work too. It seems that IE doesn't fire oninput on contenteditables.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 31, 2016 0