Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13027] iOS: TextField focus() event not fired when application loads in landscape mode as iPhone app on iPad

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-03-20T16:38:59.000+0000
Affected Version/sRelease 3.0.2
Fix Version/sRelease 3.1.0, 2013 Sprint 06 API, 2013 Sprint 06
ComponentsiOS
Labelsmodule_textfield, qe-testadded
ReporterDaniel Sefton
AssigneeIngo Muschenetz
Created2013-03-11T20:57:54.000+0000
Updated2017-03-22T22:10:04.000+0000

Description

*Problem description* When the app loads in landscape mode on iPad (as an iPhone app), the text field focus events are not fired when tapping on the fields. However, once a device rotation occurs, it starts working. *Test case*
var win = Ti.UI.createWindow({
	backgroundColor : '#000'
});

var registerUsername = Titanium.UI.createTextField({
	hintText : 'User ID',
	height : 40,
	left : 10,
	top : 80,
	width : Ti.Platform.displayCaps.platformWidth - 40,
	borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
var registerPassword = Titanium.UI.createTextField({
	hintText : 'Password',
	height : 40,
	left : 10,
	top : 40,
	passwordMask : true,
	width : Ti.Platform.displayCaps.platformWidth - 40,
	borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(registerUsername);
win.add(registerPassword);

registerUsername.addEventListener('focus', function() {
	Ti.API.info("Register Username: Focus Event");
});
registerPassword.addEventListener('focus', function() {
	Ti.API.info("Register Password: Focus Event");
});

win.open();
*tiapp.xml changes*
<iphone>
    <orientations device="iphone">
        <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
        <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
    </orientations>
    <orientations device="ipad">
        <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
        <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
    </orientations>
</iphone>

Comments

  1. Davide Cassenti 2013-03-12

    The problem seem to be avoided if the window is set to fullscreen:
       var win = Ti.UI.createWindow({
           backgroundColor : '#000',
           fullscreen: true
       });
       
  2. Blain Hamon 2013-03-19

    More information: This only happens on iOS 6.0 or later, both on simulator and device, and even hitting the (2x) button dispells the situation. This may be something only Apple can fix.
  3. Vishal Duggal 2013-03-19

    I wonder if it is the same issue that we saw in TIMOB-12924. A simple js workaround was provided for that issue. Would be worthwhile to investigate if the same workaround works here as well.
       Titanium.UI.iPhone.showStatusBar({animated: false});
       
  4. Blain Hamon 2013-03-19

    As far as I can tell, this is a duplicate of TIMOB-12924. Making the association.
  5. Blain Hamon 2013-03-19

    Also, Titanium.UI.iPhone.showStatusBar({animated: false}); indeed does mitigate this. Proposing that, given this is partially Apple's bug and has a workaround, that we push it off until later.
  6. Lee Morris 2017-03-22

    Closing ticket as duplicate and links to the related ticket have been provided above.

JSON Source