Skip to content
This repository was archived by the owner on May 4, 2022. It is now read-only.
This repository was archived by the owner on May 4, 2022. It is now read-only.

IOS setFocus on input make screen jump #175

Open

Description

@ionitron-bot

Original issue by @llorenspujol on 2017-01-31T16:05:40Z

Ionic version: (check one with "x")
[ ] 1.x
[x ] 2.x

I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
I have multiple inputs in a page, and I focus them manually every time using the setFocus() method. The problem is that when i do so, the page makes the correct scroll but when this scroll is finished it return to de no scroll position, is like something is cancelling the scroll. I have read a lot of issues of IOS keyboard and i still couldn't find exactly what the problem is.

In this gif is shown the current behaviour.
https://i.gyazo.com/53f5d32e166e3ef9929402bb6e9dc822.gif

Expected behavior:

Of course the current behaivour would be that when focusing the scroll stays stable.

Activity

  1. fvmsantos commented on Aug 2, 2019

    @fvmsantos

    Solution?

  2. hedshafran commented on Aug 20, 2019

    @hedshafran

    In my case, wrapping the element.focus() with setTimeout solved the issue:

    setTimeout(() => {
        element.focus();
    });
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions