Closed Bug 2083140 Opened 1 month ago Closed 1 month ago

Animate panels with the dropdown panel Nova motion design tokens

Categories

(Firefox :: Menus, enhancement, P2)

enhancement
Points:
5

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: nsharpley, Assigned: nsharpley)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-sidebar])

Attachments

(1 external file, 1 obsolete file)

Using the new design tokens in the Nova motion prototype, update the animations for dropdown panels in the toolbar upon opening and closing with an opacity, scale and translate.

Prototype: https://nova-motion-spec.netlify.app/

Priority: -- → P2

NOTE:

  1. Why not use View transitions? After some research, it appears View transitions are not an option here as the snapshot is rooted in the wrong window. The whole ::view-transition pseudo tree gets attached under the document's root element, and the snapshot containing block is the pres context's visible area - i.e. the main browser window's viewport. A XUL <panel> renders into its own OS widget (NSWindow/HWND) outside that viewport. So a snapshot of #appMenu-popup would be painted inside the browser window, in document coordinates, clipped to it - while the real popup still pops in instantly in its own window. Among other blockers...
  2. Big hurdle - macOS requires moz-window-transform in order to properly handle the native shadow, which we need as a hittable area (?). However using this property with scale makes the whole animation jumpy. I slowed the animation down and through process of elimination discovered the scale transform is causing the jumpiness - remove the scale animation and its not jumpy. This works fine on Linux and Windows though. It would seem the only fix is moving this animation off moz-window-transform in macOS using the same CSS as non-mac, removing moz-window-shadow and adding a CSS box shadow instead of the native shadow. Big no no though as the fake window shadow won't work because we can't make that shadow transparent to mouse events and hence hitting the shadow won't close the popup.

Hoping :mstange and :emilio might have some ideas on how to get around point 2?

WIP patch: https://phabricator.services.mozilla.com/D328873

Flags: needinfo?(mstange.moz)
Flags: needinfo?(emilio)

Panels now drop 4px and scale out of the corner they hang from, rather than
sliding 70px. macOS animates the -moz-window-* properties as before, so the
native window shadow comes along and the system is not asked to recompute the
window's shape mid-animation; since bug 2080204 those honour transform-origin,
so a single declaration pivots both paths on the same corner.

TO DO: use --motion-ease-emphasized`` and --motion-ease-standard` (see bug 2083138)

However using this property with scale makes the whole animation jumpy

So, just checking... What does "jumpy" here mean? What I see is that the scale animation causes the text to flicker quite a bit (on the app menu for example), specially once you're at scales close to 1, but mostly if the transition is slow. Is that what you mean? Or something else?

The patch as-is looks acceptable to me on macOS but maybe I don't have a great eye?

It would seem the only fix is moving this animation off moz-window-transform in macOS using the same CSS as non-mac, removing moz-window-shadow and adding a CSS box shadow instead of the native shadow.

Well, might not be the only fix. I see that for example NSWindow has a setFrame with animate: bool here. Maybe we could use that? That'd leave the easing function to the OS.

Big no no though as the fake window shadow won't work because we can't make that shadow transparent to mouse events and hence hitting the shadow won't close the popup.

This is the main issue that has prevented us from using custom borders / shadows in the past, yeah.


(Tangential but if you rebase it'd make it easier to apply to trunk :))

Flags: needinfo?(nsharpley)

FWIW I checked and CGSSetWindowEventShape might be a private API we might be able to use to implement our own shadows, if we wanted to go that route. There might be other edge cases like "what happens with windows that are near the edge of the monitor" and so on.

Also, this is relevant, it seems we should probably snap the translations regardless as long as the window is axis-aligned?

Flags: needinfo?(emilio)

(Nikki confirmed it did)

Points: --- → 5
Flags: needinfo?(nsharpley)
Whiteboard: [fidefe-sidebar]

Comment on attachment 9664018 [details]
Bug 2083140 - Snap cocoa widget transform accounting for scale. r=#mac-reviewers

Revision D334919 was moved to bug 2083740. Setting attachment 9664018 [details] to obsolete.

Attachment #9664018 - Attachment is obsolete: true
Attachment #9663672 - Attachment description: WIP: Bug 2083140 - Animate panels with the dropdown panel motion tokens. → Bug 2083140 - Animate panels with the dropdown panel motion tokens. r=emilio
Attachment #9663672 - Attachment description: Bug 2083140 - Animate panels with the dropdown panel motion tokens. r=emilio → Bug 2083140 - Animate panels with the panel motion tokens. r=emilio
Pushed by nsharpley@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c8e1217419b1 https://hg.mozilla.org/integration/autoland/rev/fe0077d3f3db Animate panels with the panel motion tokens. r=kcochrane,emilio,desktop-theme-reviewers,reusable-components-reviewers,jules
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7c04977c0654 https://hg.mozilla.org/integration/autoland/rev/1b5933c47ccc Revert "Bug 2083140 - Animate panels with the panel motion tokens. r=kcochrane,emilio,desktop-theme-reviewers,reusable-components-reviewers,jules" for causing bc failures @browser_parsable_css.js.

Backed out for causing bc failures @browser_parsable_css.js.

Flags: needinfo?(nsharpley)
Pushed by nsharpley@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/46633940b5b1 https://hg.mozilla.org/integration/autoland/rev/738f4eaf297b Animate panels with the panel motion tokens. r=kcochrane,emilio,desktop-theme-reviewers,reusable-components-reviewers,jules
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
Flags: needinfo?(nsharpley)
Flags: needinfo?(mstange.moz)
Regressions: 2089403
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: