Problem/Motivation
Add open close animations to both icons and the submenus.
Doing the submenus is tricky, because you can't animate the max-height between 0 and auto. There's ways around this, such as
- Instead of
display: nonethe submenu, usevisibility: hiddenandposition: absolute. - Doing so, will enable you to use JS to calculate the height of each submenu using something like offsetHeight.
- Use JS to add that height as the value of an inline custom property.
- Animate
max-heightto the value of that custom property
| Comment | File | Size | Author |
|---|---|---|---|
| #38 | animation-on-firefox.mp4 | 393.5 KB | akshayadhav |
| #37 | firefox.gif | 253.62 KB | ckrina |
| #32 | f53a76476b84320ac1d2ed9f80f4506f.gif | 1.06 MB | finnsky |
Issue fork drupal-3374460
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Issue fork navigation-3374460
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
baluv3 commentedMoved this issue from https://github.com/Lullabot/navigation and assigned credit.
Comment #4
baluv3 commentedComment #5
claireristow commentedWorking on this now!
Comment #6
claireristow commentedPausing work on this one to work on higher priority tickets. Will pick it up again later.
Comment #7
claireristow commentedUnassiging in case someone else wants to pick it up
Comment #8
shaalThere's a really nice technique to animate dropdowns using CSS grid.
Comment #10
Ricardocg commentedJust added an animation to the menus dropdown. Please review.
Comment #11
Ricardocg commentedComment #13
finnsky commentedAdded couple of comments! Thanks!
Comment #14
Ricardocg commented@finnsky Hi, I think the '&' is necessary for it to work since we do not want to add those two lines of code to all nav items, only to the ones with a dropdown. :)
Comment #15
finnsky commented@Ricardocg
Please take a look
https://git.drupalcode.org/issue/navigation-3374460/-/commit/b392846e4eb...
Also we have error in js `aria-expanded` :)
Comment #16
Ricardocg commentedHi, as for the scrollIntoView, i can not see any difference compared with the 1.x branch.
Regarding the js error, the change came from the merge with 1.x, and the code is already there (https://git.drupalcode.org/project/navigation/-/blame/1.x/js/sidebar.js). I can try to figure it out, but I do not know the implications it might have.
Comment #17
finnsky commentedThis is what not working at the moment on 1.x. 1440x900 screen:
https://gyazo.com/3d8906bb5c301be0b93a6d077f6813a1
It seems works different in this branch, maybe cause of new wrappers, maybe cause of animation delay. Please review.
Comment #18
Ricardocg commentedHi, I used the tugboat of another issue (#3388367) and the scrollIntoView is also not working. Here is a link for you to check: https://mr102-sdg73tajacsrfsxllki9tduxei4xrknq.tugboatqa.com/en/user/1?c...
Should we create a separate issue?
Comment #19
finnsky commentedStill working for me in that tugboat you linked.
Comment #20
ckrinaThanks @Ricardocg for working on this!! The transition looks really cool!
But I see the same as @finnsky: in my local with the latest code in 1.x the scroll to the active item works well, but not with this MR.
I've also left a few extra comments on the MR, so moving this to Needs work.
Comment #23
Ricardocg commentedI just made a new merge request from a new branch based on the current 1.x since the previews branch was merging changes that i did not make. :)
Comment #24
ckrina@Ricardocg if this is ready to review the status needs to change to "Need review" :)
I was going to review it but it looks like it will need to be rebased with all the work that happened, so leaving it as Needs work.
Comment #25
ckrinaComment #26
ckrinaActually, moving to NW because it needs to be rebased with the latest code.
Comment #31
finnsky commentedI think we also need to make it work with about
https://css-tricks.com/introduction-reduced-motion-media-query/
Gonna work on it
Comment #32
finnsky commentedComment #34
finnsky commented1. Added new media query
--admin-toolbar-reduced-motion (prefers-reduced-motion); to achieve #31
2. Reverted existing transitions for expand collapse sidebar etc for same reason.
3. Applied css transitions with css grid as recommended in #8 Looks good imo.
4. Also added animation for rotate buttons arrows. Not sure if we need it actually.
Please review!
Comment #35
finnsky commentedComment #37
ckrinaI really like this small details, thank you.
It looks great in Chrome, but unfortunately, this doesn't work with Firefox:
Comment #38
akshayadhav@ckrina
I tested this change on Firefox in Ubuntu. It worked fine on my end.
Comment #39
ckrinaComment #41
ckrina