You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update animations functionality to only support the native popover approach (#970)
* Change how popover animations work and update docs
* fix: modal route not working + naming
* fix: modal route not working + naming #2
* fix: p code style
* chore: remove unnecessary import
* refactor: make compatibility note easier to maintain
---------
Co-authored-by: maiieul <[email protected]>
We are removing the existing popover animations shimming and instead wil now only support native popover animations. This is considered a breaking change but will be more reliable overall.
@@ -170,33 +168,29 @@ This is done in a separate layer so that styles are easily overridable in consum
170
168
171
169
## Animations
172
170
173
-
Animating things to display none has historically been a significant challenge on the web. This is because display none is a `discrete` property, and is **unanimatable**.
174
-
175
-
> There is currently efforts to solve this problem. [New CSS properties](https://developer.chrome.com/blog/entry-exit-animations/) have been introduced, but currently do not provide good enough browser support.
171
+
Modals require smooth entry and exit animations to enhance user experience. However, animating properties like display and overlay can be challenging because they are discrete properties and not traditionally animatable.
176
172
177
-
### Our current approach
173
+
Modern browsers have introduced discrete animation capabilities, allowing us to animate these properties effectively. Below, we'll explore how to implement animations and transitions for modals using keyframe animations and CSS transitions.
178
174
179
-
Qwik UI automatically detects any `animation` or `transition` declarations under the hood and waits for them to finish before closing the modal. If there is no animation, then it will close normally.
175
+
### Keyframe Animation Example
180
176
181
-
### Adding a transition
177
+
Keyframes are ideal for handling the entry and exit of the modal. Here's an example using modalOpen for opening and modalClose for closing the modal:
182
178
183
-
<Showcasename="transition" />
179
+
<Showcasename="animatable" />
184
180
185
-
To add an transition, use the `data-open`, `data-closing` and `data-closed` data attributes. Above is a snippet where we transition both the modal and backdrop's opacity.
181
+
### Transition Declarations
186
182
187
-
### Adding an animation
183
+
Transitions are useful for animating properties like opacity and transform. Here's how to implement transitions for the modal:
188
184
189
-
<Showcasename="animatable" />
185
+
<Showcasename="transition" />
190
186
191
-
To add an animation, it's the same as with transitions, using the `data-open` and `data-closing` data attributes. Below is a snippet of the animation example above.
187
+
<TopLayerAnimationsCaveats />
192
188
193
189
### Backdrop animations
194
190
195
-
Backdrop animations have also made significant progress in the last year, with support provided in over half of the major browsers, and close to 70% of users.
196
-
197
-
To add a backdrop animation, make sure to use the `::backdrop` pseudo selector to the end of the `data-closing` or `data-open` classes.
191
+
To animate the modal's backdrop, use the `::backdrop` pseudo-element and include it in your keyframes or transitions:
198
192
199
-
> Firefox currently does not support backdrop animations. The fallback for browsers that do not support animated backdrops is the same as a non-animated backdrop.
0 commit comments