Skip to content
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

SiteSelector: Remove selector state binding #14028

Merged
merged 3 commits into from
May 29, 2017

Conversation

mcsf
Copy link
Member

@mcsf mcsf commented May 14, 2017

Part of #14024

Also fixes keyboard navigation in SiteSelector, a feature knowingly broken in #13094 and introduced in #5808.

Testing

Try to switch sites, select all sites, etc., in different Calypso sections. Try to switch sites with the mouse, the keyboard, both. Site switching should continue to work as expected; keyboard navigation should now be working properly, e.g.:

  • open the site switcher
  • hover the mouse over a site; the site should become highlighted
  • without further moving the mouse, navigate up or down with the keyboard
  • the highlighting should move up or down starting from the previously highlighted site

@mcsf mcsf self-assigned this May 14, 2017
@matticbot matticbot added the [Size] L Large sized issue label May 14, 2017
@matticbot
Copy link
Contributor

@mcsf mcsf force-pushed the remove/site-selector-state-binding branch from 0917665 to f05c8f0 Compare May 14, 2017 21:38
@mcsf mcsf added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels May 14, 2017

return path;
}
};
Copy link
Member Author

Choose a reason for hiding this comment

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

  • Are there precendents of such thunks that never dispatch any action and instead only call getState and perform some side effect (in this case, page call)?

Note that, in the future, if we add middleware-level routing support (e.g. dispatch( { type: 'NAVIGATE', path } ), the above becomes a "normal" thunk which calls getState in order to have sufficient data to then dispatch a routing request.

  • The remaining question: given its nature, where should this action creator live?

@mcsf mcsf force-pushed the remove/site-selector-state-binding branch from f05c8f0 to bc970a4 Compare May 15, 2017 18:51
@johnHackworth
Copy link
Contributor

I'm not sure if I'm doing something wrong when testing, but it doesn't seem to work for me. Neither it hightlights the site on mouse over or the keyboard navigation works... Am I missing something? :/

@mcsf
Copy link
Member Author

mcsf commented May 17, 2017

@johnHackworth, this is what you should be seeing:

site-selector-keyboard

First I'm moving my mouse and hovering over sites, then I switch to Up/Down arrows on my keyboard.

@johnHackworth
Copy link
Contributor

hmm, I'm not sure what's going on, but this is me doing the same while running this branch on my localhost:

may 17 2017 10-50 pm

@johnHackworth
Copy link
Contributor

maybe chrome/linux related?

@mcsf
Copy link
Member Author

mcsf commented May 17, 2017

It's working on all of Firefox, Chrome, and Safari on my Mac. It may be Linux-related.

@johnHackworth
Copy link
Contributor

Hmm, I've just tested and it works fine in firefox/linux ... it looks like it's a chrome/linux (Versión 56.0.2924.87 (64-bit) ) issue

@mcsf mcsf force-pushed the remove/site-selector-state-binding branch from bc970a4 to caf8478 Compare May 26, 2017 11:26
@marekhrabe
Copy link
Contributor

I was the original author of keyboard navigation for this component. With this fix in place, it looks like we have the desired behavior working again. Thanks for fixing it :)

Regarding the code, I like the move of navigation code out of the compoenent and making it an action. Not sure where it should live to be honest…

Copy link
Contributor

@marekhrabe marekhrabe left a comment

Choose a reason for hiding this comment

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

Functionality works and I'm fine merging as-is, unless we have more usages for navigation actions or you just wanna dig deeper. Once we have more, it might be a good idea to collocate them.

@mcsf
Copy link
Member Author

mcsf commented May 29, 2017

Not sure where it should live to be honest…

For now, I honestly wouldn't mind to leave it there, as it's very component-specific and doesn't dispatch anything. Anyone who feels strongly otherwise can just point it out. :)

@mcsf
Copy link
Member Author

mcsf commented May 29, 2017

Once we have more, it might be a good idea to collocate them.

Agreed, but let's move. Thanks for the review!

@mcsf mcsf merged commit 246b491 into master May 29, 2017
@mcsf mcsf deleted the remove/site-selector-state-binding branch May 29, 2017 15:20
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants