Skip to content

fix(ios): expose keyboard animation params as CSS custom properties#56

Open
real-alexei wants to merge 2 commits intoionic-team:mainfrom
real-alexei:fix/ios-keyboard-css-variables
Open

fix(ios): expose keyboard animation params as CSS custom properties#56
real-alexei wants to merge 2 commits intoionic-team:mainfrom
real-alexei:fix/ios-keyboard-css-variables

Conversation

@real-alexei
Copy link
Copy Markdown

fix(ios): expose keyboard animation params as CSS custom properties

Set --keyboard-height, --keyboard-animation-duration, and --keyboard-animation-curve CSS variables on document.body, enabling web content to animate in sync with the iOS keyboard. Removes the artificial 0.2s delay previously added to the animation duration.

Change Type

  • Fix
  • Feature

Rationale / Problems Fixed

Currently there is no way for web content to synchronize its own animations with the native iOS keyboard animation. The plugin applies a hardcoded 0.2s artificial delay to setKeyboardHeight, which doesn't match the actual system animation timing.

This PR exposes the native keyboard animation parameters (duration, curve, and height) as CSS custom properties so web developers can use them in CSS transitions/animations to stay perfectly in sync with the keyboard:

  • --keyboard-height — updated in real time as the keyboard appears/resizes
  • --keyboard-animation-duration — the system-reported animation duration
  • --keyboard-animation-curve — mapped to a CSS timing function (ease-in-out, ease-in, ease-out, linear)

Tests or Reproductions

Tested on an iOS device by observing that CSS transitions using the exposed custom properties animate in sync with the keyboard show/hide.

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

The artificial +0.2s delay on the animation duration has been removed as it is no longer needed — the real system duration is now passed through directly.

Set --keyboard-height, --keyboard-animation-duration, and
--keyboard-animation-curve CSS variables on document.body, enabling
web content to animate in sync with the iOS keyboard. Removes the
artificial 0.2s delay previously added to the animation duration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant