-
16 Apr 2012 10:51 AM #1
Cannot set focus to searchfield in iOS
Cannot set focus to searchfield in iOS
REQUIRED INFORMATION
Ext version tested:- Sencha Touch 2.0.1-rc
- iOS (5.1, device and Simulator) Safari
- Google Chrome 18.0.1025.162
- Safari 5.1.5
- When you click the button at the bottom of this sample, a panel displays with a single search field in it. I cannot set the focus to the search field under 2.0.1-rc. The focus is set correctly in Chrome and Safari on the desktop. I had this working before updating to the 2.0.1-rc.
- Browse to page in either iOS Simulator or on iOS device.
- Click the "Address" button.
- Search field appears with cursor at the end and the iOS keyboard visible.
- Search field appears, but does not have focus.
- User must tap in the search field to display the iOS keyboard.
Code:Ext.define("PF.view.Main", { extend:"Ext.NavigationView", xtype:"mainview", config:{ items:[ { xtype:'panel', id:'mainViewPanel', title:'Pizza Finder', layout:'vbox', items: [ { xtype:'formpanel', // Has to be FormPanel for iOS to show "Search" id:'singleLineAddressPanel', standardSubmit:false, // Neither of these stop the form submitting submitOnAction:false, // Neither of these stop the form submitting left:10, right: 10, top:10, height:57, // Have to add this if I make this a FormPanel scrollable:false, padding:0, centered: true, hidden: true, modal: true, hideOnMaskTap: true, hideAnimation: 'fadeOut', items: [ { xtype:'searchfield', id:'singleLineAddress', value:'222 Mason Street, San Francisco', padding:0, listeners: { action: function(c,e,o) { c.up('#singleLineAddressPanel').hide(); return false; }, clearicontap: function(c,e,o) { // The keyboard hides on the iPhone when you click clear. // That's not like native behaviour. c.focus(); return false; } } } ], zIndex:'40' }, { xtype:'toolbar', docked:'bottom', defaults:{flex:1}, items:[ { xtype: 'button', text:'Address', handler: function() { var enterAddressBox = this.up('#mainViewPanel').down('#singleLineAddressPanel'); // p.getComponent('singleLineAddressPanel'); enterAddressBox.show(); enterAddressBox.getComponent('singleLineAddress').focus(); } } ] } ] }] } });
HELPFUL INFORMATION
See this URL for live test case: http://geeknixta.com/demo/pizzafinder/
Debugging already done:- Have pulled out all other code.
- Have tried to set focus explicitly on the show event of the formpanel and the search field (search field's show event seems not to fire).
- Have tried to set the searchfield as the active item on the formpanel.
- iOS 5.1
-
16 Apr 2012 11:41 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
Have you rebuilt your css with compass wince upgrading to 2.0.1RC?
-
16 Apr 2012 11:45 AM #3
Hi Jamie,
Had no idea I might need to do that
I took the 2.0 SDK, was given a very bare-bones sample app, modified the resources/css/app.css file slightly, and then pointed to the 2.0.1-rc SDK.
So far in my 3.5 weeks of Sencha I haven't touched compass. I'll try to do that now and will let you know.
Thanks,
Nick.
-
16 Apr 2012 12:15 PM #4
-
16 Apr 2012 2:39 PM #5Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
Ok, we'll take a look at it.
-
1 May 2012 10:05 PM #6
I have same problem. Not working in Chrome or Safari. Tried many different ways / listeners to call the focus from. i could only get it to focus when I set the blur event to cause the focus() and then when I blur it it refocuses, which is good, but can't get that to happen upon painted or show or similar listeners.
-
5 Jun 2012 2:02 AM #7
HI,
I have some problem with set focus on textfield , I have open a Ticket also
I hope this problem will be solve soon
Thanks
Davide
-
6 Jun 2012 12:25 AM #8
Problem is CSS, if I will comment css file in index.html I resolve the problem, focus work
... but the page/program is without css and It is unusable... of course (but focus work) :-)
-
6 Jun 2012 10:34 AM #9
-
7 Jun 2012 2:10 AM #10
Hi,
I refer to iOS system
In androdi or Chrome or Safari desktop browser (MAC) I haven't problem
The problem is focus on iOS sytem... no Emulator but with real device (IPAD,IPHONE)
You found a bug! We've classified it as
TOUCH-2765
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote