Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14529] iOS: TextField focus doesn't work when TextField isn't visible

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.1.1, Release 3.2.0
Fix Version/sn/a
Componentsn/a
Labelsfocus, textfield
ReporterMatej
AssigneeUnknown
Created2013-07-04T08:36:07.000+0000
Updated2018-02-28T20:04:04.000+0000

Description

*Problem* TextField focus doesn't work when TextField isn't visible on a screen. *Steps to reproduce* 1. Launch app 2. When you stay on the top of a TableView you can see first TextField there focus work without any problem 3. Try to hide shown keyboard for first TextField and scroll/move to the bottom of a TableView (There the focus doesn't work) *Test case*
 
var win = Ti.UI.createWindow();
var table = Ti.UI.createTableView({
	style : Ti.UI.iPhone.TableViewStyle.GROUPED
});
var data = [];

for (var i = 0; i < 20; i++) {
	var row = Ti.UI.createTableViewRow({
		width : Ti.UI.FILL,
		height : Ti.UI.FILL
	});
	var tField = Ti.UI.createTextField({
		width : Ti.UI.FILL,
		height : "100%"
	});

	row.add(tField);
	data.push(row);
}

table.data = data;

win.add(table);
win.open();

setInterval(function() {
	data[0].children[0].focus();
}, 3000);

Comments

  1. Matej 2013-07-07

    Sorry for double issue
  2. Daniel Sefton 2013-07-09

    Sorry I don't understand. How can you focus a TextField which is out of view?
  3. Matej 2013-07-09

    I don't understand "out of view". In sample above I want to focus TextField which is in the first row of a TableView. Or another example. User filled table with 10-20 rows/TextFields and now he is in the bottom of a TableView - on a last row. He pressed SAVE button ,but first/second... TextField is filled wrong ,so I want to set focus for this TextField ,but unfortunately I can't...
  4. Daniel Sefton 2013-07-09

    By out of view I mean how can you focus a TextField which you can't see. However, are you referring to the auto scrolling by any chance? Where if you're focussed on the bottom TextField and try to scroll up it scrolls back down. It's still possible to enter focus into a top TextField however, you just need to be fast.
  5. Matej 2013-07-11

    But why I can't focus a TextField which I can't see? That isn't normal behavior or? Basically if is user on the bottom of a TableView and last TextField has focus / doesn't has focus (It is doesn't matter) I can't set focus for first TextField (For example, it may be second, third TextField...). After set focus for first TextField I want to move/scroll TableView to this TextField ,so user can see TextField where he has to put/change data ,but unfortunately I can't...
  6. Daniel Sefton 2013-07-11

    My apologies, I totally looked over the fact that it had an interval programatically setting the focus :/ Tested and confirmed on iOS 6 simulator with Ti SDK 3.1.1 GA and latest 3.2 CI.

JSON Source