-
Notifications
You must be signed in to change notification settings - Fork 4.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
Post author selector: try downshift #7478
Conversation
@afercia appreciate a quick review of this approach as well when you have a moment! |
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.
Thanks for trying to move this forward. Might be good to get some a11y insights on Downshift.
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PostAuthorCheck from './check'; | ||
|
||
/** | ||
* External dependencies | ||
*/ |
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.
In general the external dependencies are defined above all other deps, but this is not an official guideline :)
* External dependencies | ||
*/ | ||
import Downshift from 'downshift'; | ||
import { debounce } from 'underscore'; |
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.
Should we use lodash
instead?
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.
oops, right :)
} | ||
const payload = '?search=' + encodeURIComponent( query ); | ||
this.setState( { searching: true } ); | ||
apiRequest( { path: '/wp/v2/users' + payload } ).done( ( results ) => { |
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.
Should we leverage the data module instead? We already have a users
reducer their which I believe should be refactored to be an entity and build support to searching/pagination into the entities. related #6395
@adamsilverstein good morning, thanks for the ping. Looking just at the a11y side, I'm not particularly happy with what When an option in the list gets highlighted, it should also get
Instead, they switch it to There are other minor quirks, for example:
Aside: the component crashes in IE 11 because it uses Info for the ones willing to test |
[ edit ] Re-uploading as something weird happened to my images - sorry for second post on this. I have a suggested design, firstly lets have at the top as this is a common use. I would like to not have the input next to 'author' as we could have very probably cases of long author names. Let's have it as a section, this also allows it to have multiples in future. The design itself takes a lot of inspiration from links and should work. |
@afercia :( Maybe I should double back on my autocompleter based implementation. Could you try this PR as well? #7385 |
@karmatosed Thanks for the design, that is great and I like how it feels to give the field more room. question: when there is already a user selected and i click in the box, should the field clear/show the placeholder? |
Just noting the design of the field is one more case where the placeholder is used as replacement for a label. We've warned several times this is far from ideal for accessibility and goes against the HTML spec. |
Can we still have a label instead of a placeholder then, say something like |
We're using a lot of labels visually hidden with |
Got it, thanks for clarifying. |
Yes it should clear. |
Is it likely this will be resumed, or can it be closed? |
Closing this. I'll add any further work on #7385 |
Description
This PR adds a selector implementation built with downshift, an MIT licensed
downshift
from PayPal which aims to provide "Primitives to build simple, flexible, WAI-ARIA compliant React autocomplete/dropdown/select/combobox components"Addresses #7384
How has this been tested?
wp user generate --role=editor --count=12000
Screenshots
Types of changes
Questions / Todo
Checklist: