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
feat: Ability to locate and animate content relative to the keyboard #28864
Comments
Hello @drakedeatonuk thanks for this feature request! I can see you have also experienced the pain that is trying to animate any content relative to the keyboard position! Based on the current state of technology, this is difficult for anyone to do perfectly in all environments. Devices are notoriously inconsistent with the rendered keyboard height. We have to use a mixed strategy of starting an animation when the keyboard show event is dispatched and doing a best guess to the animation duration & curve when animating to a fixed position relative to the keyboard height. Almost every implementation I've seen that has tried this either animates their custom content a little off from the keyboard or they wait until the keyboard has fully appeared before revealing an accessory bar. I will discuss with the team and see if we have opinions on how to best handle this. Due to the limitation of how well we can also do this out of the box, potentially documentation and/or a blog may be better suited so developers can customize the implementation to match their device demographics best. |
@sean-perkins I feel like there should be a support group from people who've gone down the custom mobile keyboard content animate rabbit hole! A blog or a page of documentation on best practices/ different approaches would be very valuable I think. I know long I spent looking for resources and not quite ever finding the help I wanted. Perhaps some examples of approaches to try could be included too. Recently I've been toying with animating a There are truly some serious "gotchyas" when it comes to keyboard events too. For example, when a keyboard with auto-fill suggestions at it's top opens, ios actually sends two onWillShow and onDidShow events. This in particular created some headaches for creating animations as it makes it much harder to figure out if keyboard events were, from the users perspective, related to a keyboard appearing, or changing height. Recently I've been gathering some measurements from ever ios devices as it seems that keyboard heights are always consistently off by a certain amount: Can I ask, have you guys ever had any luck with this type of approach? |
Hello @drakedeatonuk apologies for the delay. Static offsets might be difficult to manage over time and respond to dynamic conditions (screen rotation, etc.). I would like to track this feature as introducing a new component/API that enables developers to slot through custom content that can respond with reasonable accuracy to the presence of the keyboard and adapt to the height changes with features like the accessory bar. |
Prerequisites
Describe the Feature Request
It would be great if ionic handled animating the ion-footer (or ion-toolbar) on mobile when the keyboard opens & closes.
The implementation could look something like this:
https://github.com/ionic-team/ionic-framework/assets/41165256/6103fc21-1988-488e-bcbc-4d4123621fd1
With additional animations when the keyboard height changes while open like this:
https://github.com/ionic-team/ionic-framework/assets/41165256/3540978e-86c7-4936-bcc2-6e8f44570029
Additionally, there could be options for also resizing the ion-content's inner scrollable container.
This could be a new keyboard resize mode potentially?
Describe the Use Case
This would provide a vastly better UX when ion-footer's & keyboards together.
Describe Preferred Solution
No response
Describe Alternatives
I've built my own solution to this, but it's far from perfect and was way too time-consuming to be viable as a general solution to this.
Some issues still remain like, if I navigate to a different page, if a dont let the ion-footer animation complete before the page transitions, the ion-footer on the next page is in the wrong place... I'm sure there's a better under-the-hood solution to make the animation work better with the navigation animation.
Related Code
here's an example of the service I've made for this animation:
The text was updated successfully, but these errors were encountered: