Issue 32: textfield.focus() fails after initiating iScroll
Status:  Invalid
Owner: ----
Closed:  Oct 2010
Reported by charles%...@gtempaccount.com, Oct 20, 2010
What steps will reproduce the problem?
1. Add a textarea element outside of the scrollable area (I know form elements don't work well with CSS animation).
2. Add an iScroll object to a page.
3. Try calling .focus() function on that textfield element to automatically focus that element and bring up the keyboard.

What is the expected output? What do you see instead?

The textarea should be focused and the keyboard should be brought up so the user can start typing into the textarea immediately. Instead, the text area doesn't get focused.

What version of the product are you using? On what operating system?

iScroll 3.7.1 and tested on iPhone 3.1.3 and Android 2.2.

Please provide any additional information below.

Here's a code example.

<div>
  <form>
    <textarea id="ta"></textarea>
  </form>
  <div id="scroller-wrapper">
    <div id="scroller">stuff</div>
  </div>
</div>

<script>
  myScroller = new iScroller('scroller');
  .
  .
  .
  obj = document.getElementById('ta');
  obj.focus(); 
</script>

Here's the mobile web site i'm working on, which a code similar to the above have been deployed to and the defect can be observed.

http://stage.m.mindbloom.com

id/pw:
charles@mindbloom.com/12

To get to where the issue happens, go to actions -> click All from header -> click one of the actions -> click "edit entry" or "add entry" from one of the journal entry bubbles.
Oct 21, 2010
#1 charles%...@gtempaccount.com
The website I've provided above may not work right now as I'm editing it pretty heavily. It's possible that I'll just not use iScroll on this site for good.
Oct 25, 2010
#2 charles%...@gtempaccount.com
Well, I found out that if .focus() function is called by a fake event (like the one in touchEnd in iScroll line 335), it doesn't bring the keyboard up even though the function is triggered. It's likely the mobile browser bug. There really isn't a workaround for this because the fake event is necessary for the custom touch events to work. It seems like the keyboard only comes up if it is triggered by a genuine click event. You may close this ticket as it isn't iScroll's fault.
Oct 25, 2010
Project Member #3 mat...@gmail.com
(No comment was entered for this change.)
Status: Invalid