GitHub Issue | n/a |
Type | Bug |
Priority | Low |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2016-02-16T18:02:53.000+0000 |
Affected Version/s | Release 5.1.2 |
Fix Version/s | alloy 1.7.33, alloy 1.7.34 |
Components | n/a |
Labels | mobileweb, newline, suppressReturn, textarea |
Reporter | Max Navsii |
Assignee | Chris Barber |
Created | 2014-02-14T20:15:55.000+0000 |
Updated | 2016-06-03T16:20:30.000+0000 |
Textarea does not want to add a new line when I'm pressing return key (from my keyboard) when I run the application as a "Mobile Web Preview in Browser". However it works great when running in an Android Emulator.
Steps to reproduce :
1) Create a new project (use the "Two-Tabbed Alloy Application" sample)
2) In the project, replace index.xml with the one in the attachment files.
3) Run the application as a Mobile Web Preview in Browser
4) Try to type in the textarea, and push return key from your keyboard
5) It will loose focus instead of adding a new line.
Moving this ticket to engineering as the provided sample works fine with iOS application but does not work with Mobile Web application (tried with Studio in-built browser as well as Safari).
I realize that the problem only happens with Alloy when I define [suppressReturn="false"] on the XML file. In this case, the generated .js file (in Resources folder) has a [suppressReturn: "false"] (with quotes) that is evaluated as true by the JavaScript interpreter. The same happens if I define [suppressReturn=false] (without quotes) on a xml. When I define [suppressReturn: false] on the .tss file, the generated .js file have a [suppressReturn: false] (without quotes) and all works as expected.
PR: https://github.com/appcelerator/alloy/pull/756 This fix may cause other issues. Since Alloy doesn't know the data types of each attribute, it simply will have to check if the string value equals "true" or "false", then cast as a boolean. We should add a proper fix in a future Alloy release.
[~cb1kenobi] alternatively, we could let Alloy use a fork of the xmldom package we use and only cast these types when no quotes are used, which
sax.js
handles here: https://github.com/jindw/xmldom/blob/master/sax.js#L270 https://github.com/jindw/xmldom/blob/master/sax.js#L298[~fokkezb] I don't want to use a fork of xmldom, especially since I'm going to be tackling the Alloy build soon.
Fair enough :)