-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Velocity issue when changing focus before running animation #864
Comments
Velocity V1 is unsupported except for any major issues that might turn up - can you repeat with the V2 beta and see what the result is. Do note that there are several differences, such as |
Hi @Rycochet, thank you for your response.
I have the same issue. First, animations works fine: moving 1 element forward in the wizzard (rtl), and then going backwards (ltr). But when I try to go forward again, the animations stop working. I found it really weird, since the first animation going forward works just fine. Any other thoughts would be really appreciate it. |
Just FYI, you can use I am wondering if the lack of cache might be part of the issue - that's not really something that should be used manually, and forcefeeding both directions would be safer to do in this situation. If that doesn't make any difference then can you put a demo up on JSFiddle that shows the issue (and I can then check it in the various browsers). This is far more of a SO question btw, although there is the possibility that it is yet another Safari bug that we might be able to work around. |
I'll will try to put out a JSFiddle and let you know @Rycochet. I'll will add that this issue is not just an iOS problem. You can test this in a Chrome desktop browser and you can see the problem there too. Thank you, I'll contact you when I get the fiddle done! |
My system information
Checklist
I'm using VelocityJS in a ReactJS, building a mobile web and I found an issue related to iOS, the keyboard and the change of (input) focus.
In iOS, using the UIWeView, there is a problem changing the focus to an input (and wanting the keyboard to stay visible) if you are outside of an event started by the user (example: click of a button). A simple example is using a setTimeout to set the focus (focus() not working within setTimeout on iOS, i.e. https://stackoverflow.com/questions/6866433/focus-not-working-within-settimeout-on-ios).
This is clear when there is an animation. I have N divs loaded in the DOM, with only one visible (ordered by z-index). Each div has an input with a "Next" button at the bottom (a kind of form, wizard like) . We are performing a mobile-style animation where the current visible div goes away right-to-left and the next div (in the z-index order) becomes visible in the same way. I perform this by using translateX (and force-feeding) to move the divs in the animation.
If we set the input.focus() (input of the entering div) in the "complete" event of the animation, the keyboard goes away. We are launching the animation in the click event, but the change of focus occurs in a diferente event ("complete" event of velocity).
Now, I tried to do it without the "complete" event. When the button is clicked, before starting any animation, I change the focus to the other div's input. Then, I call velocity on the divs to perform the animation. This works and the keyboard does not get hide. But the problem is, the animation gets broken after playing around (going back and forward, right-to-left and left-to-right between two or any divs).
My code is:
This method gets called in the click event. If the this.changeFocus(divToShowId) method get called in the "complete" event (this.animationComplete(..)), there are no problems with the animation and they work just fine (but I have the keyboard issue). If I change the focus before calling the animations, the keyboard keeps open, but the animation starts to misbehave.
Any thoughts? Thanks!
The text was updated successfully, but these errors were encountered: