Repository navigation
feat(fab-button): add animated prop to disable state transitions and expose inner part - #31743
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… dynamic height test
brandyscarney
left a comment
There was a problem hiding this comment.
Looks good! I checked the default, reduced motion, animated="false" and the global config on the preview, and they all behave as described. One small suggestion on the reduced motion transition.
One question, not blocking: ion-fab-list still staggers its buttons in (i * 30ms in activatedChanged) when animated is false, the global config is off, or reduced motion is on. Setting animated on the list buttons doesn't affect that, since it only gates their own transitions. It's barely visible, so I'm fine leaving it, but should the list skip the stagger when the main fab button isn't animated? Could be a follow-up.
…y disable the transform
|
Thanks @brandyscarney! I think it could make a lot of sense for that to be a new public property on ion-fab-list, so I've created FW-7991 to track that and get that into 9.1 as its own separate feature |
brandyscarney
left a comment
There was a problem hiding this comment.
Thanks for making the changes and follow-up ticket. Looks great!
…nto FW-7511 # Conflicts: # core/src/components/fab-button/fab-button.tsx # core/src/components/segment-view/test/dynamic-height/segment-view.e2e.ts
…1778) Issue number: internal --------- ## What is the current behavior? Currently, a fab list shows its buttons one at a time when it opens, even when the main fab button has `animated="false"`, the global `animated` config is `false`, or the user prefers reduced motion. Setting `animated` on the list buttons doesn't help because it only covers their own transitions. ## What is the new behavior? - Added an `animated` prop to `ion-fab-list`. When it's `false`, every button in the list shows at once. - The list also skips the stagger when the global `animated` config is `false` or the user prefers reduced motion. - Inside an `ion-fab`, the list follows the main fab button's `animated` unless the list sets its own. This only controls whether the list buttons show one at a time. Each button in the list still scales and fades in unless it also has `animated="false"`. ## Does this introduce a breaking change? - [ ] Yes - [X] No But it is a new feature, which is why it's pointed at `feature-9.1` ## Other information This is the follow-up from [Brandy's review on #31743](#31743 (review)). The fab on the right of the fab button animation test page has `animated="false"` on its main button, so its list should now open all at once: [Fab button animation test page](https://ionic-framework-git-fw-7991-ionic1.vercel.app/src/components/fab-button/test/animation?ionic:mode=md)
Issue number: resolves #20177
What is the current behavior?
Currently, the fab button always rotates and scales between its content and the close icon when a fab list opens. That transition lives in the shadow DOM, so there's no way to turn it off, and it ignores both the global
animated: falseconfig andprefers-reduced-motion.What is the new behavior?
animatedprop toion-fab-button. When it'sfalse, or the globalanimatedconfig isfalse, the button doesn't transition at all.prefers-reduced-motion: reduce, the content and close icon crossfade instead of rotating and scaling, and the iOS press no longer scales the button. This follows the reduced motion rule in the animations and gestures design doc, which is to remove movement and scaling but keep short opacity changes.Does this introduce a breaking change?
But it is a new feature, which is why it's pointed at
feature-9.1Other information
The prop only affects the button it's set on, so buttons inside an
ion-fab-listneed it too. The md ripple still plays withanimated="false"because it comes fromion-ripple-effectrather than the button's transitions, but the globalanimated: falseconfig already turns it off.To check reduced motion, turn on "Emulate CSS media feature prefers-reduced-motion" in the DevTools Rendering panel.
Current dev build:
Animation test page (MD)
Animation test page (iOS)
Animation test page with
animated: falseconfigDocs
Related docs PR