Skip to content

Comments

Normalize /sites sidebar animation on desktop.#101817

Merged
StevenDufresne merged 4 commits intotrunkfrom
fix/multi-site-sidebar-animation
Mar 28, 2025
Merged

Normalize /sites sidebar animation on desktop.#101817
StevenDufresne merged 4 commits intotrunkfrom
fix/multi-site-sidebar-animation

Conversation

@StevenDufresne
Copy link
Contributor

@StevenDufresne StevenDufresne commented Mar 25, 2025

Related to #92911

Why are these changes being made?

When you click through the sidebar items, you'll get differing animations in the sidebar.

Proposed Changes

At face value, this seems like a problem with the transition and, it kinda is I guess.

We switch out --sidebar-width-max from 272px to 295px once we add .is-global-sidebar-visible in client/layout/index.jsx.

With Domains and Themes there is a delay in isGlobalSidebarVisible being said to true. That delay is why we see the transition.

The solution in this PR is to add the routes to getSiteDashboardRoutes which is used by shouldShowSitesDashboard to determine (earlier) that we are viewing a page with the global sidebar.

Considerations

I don't completely understand the implication of adding the routes here. The comment suggests that apart from affecting this layout, the presence of those routes will determine where they should up. Reading through the associated p2 also leaves things unclear for me.

Maybe you can confirm or provide better context @fushar? (Updated here).

Screenshots

Before After
Screen Capture on 2025-03-26 at 11-20-33 Screen Capture on 2025-03-26 at 11-22-09

Testing Instructions

  • Go to /sites
  • Click on "Domains" & "Themes"
  • You should not see any width transition in the sidebar.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@github-actions
Copy link

github-actions bot commented Mar 25, 2025

@StevenDufresne StevenDufresne changed the title Normalize /sites navigations on desktop. Normalize /sites sidebar animation on desktop. Mar 25, 2025
@matticbot
Copy link
Contributor

matticbot commented Mar 25, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~8 bytes added 📈 [gzipped])

Details
name         parsed_size           gzip_size
entry-main         +28 B  (+0.0%)       +8 B  (+0.0%)
entry-login        +28 B  (+0.0%)       +8 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

matticbot commented Mar 25, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/multi-site-sidebar-animation on your sandbox.

@StevenDufresne StevenDufresne force-pushed the fix/multi-site-sidebar-animation branch from c4e89fc to 071a9a1 Compare March 26, 2025 01:57
Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I believe it is an acceptable solution for now given the current way on how we do things.

There's more context and discussion here: paYKcK-5Qk-p2

@StevenDufresne StevenDufresne marked this pull request as ready for review March 26, 2025 02:50
@StevenDufresne
Copy link
Contributor Author

StevenDufresne commented Mar 26, 2025

@fushar Thanks for the quick review.

Luckily an e2e test failed and exposed an error in the original logic. Because we're using startsWith to determine if a route matches, if a user is using the default WordPress.com interface and clicks "Appearance > Themes", the URL would be /themes/{domain} and they would be re-routed to the sites-dashboard even though they are in their "sites" context. Same problem with /domains/manage/. I've broken out those routes and moved them into shouldShowSitesDashboard. I also moved them into a function called tangledBasePaths to communicate that they are still used in both contexts and added some test cases.

Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oohhh.... good catch 🤦 thanks, I've smoke-tested and didn't find any regression 👍

@StevenDufresne StevenDufresne merged commit 2796a8b into trunk Mar 28, 2025
14 of 16 checks passed
@StevenDufresne StevenDufresne deleted the fix/multi-site-sidebar-animation branch March 28, 2025 01:22
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.

3 participants