-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Site Picker: Show selected site first #1507
Conversation
Especially when adding a new post I almost always want to post to the current site I have worked with – looked at posts, stats, etc. It doesn’t make much of a difference in the sidebar picker, so I didn’t exempt it from the change. Note: in some cases (opening the reader directly) we don’t have the selected site yet and we can’t show it. For now I decided not to fetch it if missing.
@@ -375,7 +375,7 @@ SitesList.prototype.getSite = function( siteID ) { | |||
// clashes between a domain redirect and a Jetpack site, as well as domains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to move the comment as well to the new function. Since it gives it a bit of a better idea why we are doing the comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you’re totally right, @enejb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9edad5b.
One side effect of this is that after selecting a site in the sidebar, next time you open the sidebar the site that you selected is not in the same position but at the very top. Which I think it is ok but a bit strange, because the sites move around in the sidebar. Could we maybe make this behaviour more dependent on a prop in the site selector? Since I think it is a really good improvement in the site selector for creating new post or page. Other then that it works as expected. 👍 |
After using this branch for a bit, I found having the selected site on top in the sidebar picker very useful, because there isn’t another easy way to go back after clicking
To be honest, I’d rather not add too many options :) Added |
It's not ideal to shuffle items around because breaks the ability to memorize, and makes any temporary change (i.e. switching once and then going back to the usual pattern) breaking it further. The correct approach in this case should lean to find a way to solve the issue while preserving the mental model. For example, we cando a light highlight (lol — light gray background for example) and have the selector pre-scrolled to the latest position it was. This covers properly all the needs:
|
The high-level goal of making it easier to get back to the current site is something I've often wanted to do, but I agree with @folletto that we should do this via scroll position and a highlight, instead of rearranging the sites list. I took this approach in #1641. I think rearranging sites is even more of a cognitive burden for the typical user who only has 2 or 3 sites. Better to have them stay in the same place with a clear highlight. From a code debt perspective this is also a cleaner approach. Here are the methods currently in
We already have lots of methods around selected sites, like IMO adding miscellaneous methods to |
// clashes between a domain redirect and a Jetpack site, as well as domains | ||
// on subfolders, but we also need to look for the `domain` as a last resort | ||
// to cover mapped domains for regular WP.com sites. | ||
return site.ID === siteID || site.slug === siteID || site.domain === siteID || site.wpcom_url === siteID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't write this, but... 😢
I think this PR might not be needed any more since #1641 fixes some of the issues that this PR was solving. |
@nb Okay to close? |
Especially when adding a new post I almost always want to post to the
current site I have worked with – looked at posts, stats, etc.
It doesn’t make much of a difference in the sidebar picker, so I didn’t
exempt it from the change.
Note: in some cases (opening the reader directly) we don’t have the
selected site yet and we can’t show it. For now I decided not to fetch
it if missing.
Testing instructions: