-
Notifications
You must be signed in to change notification settings - Fork 391
fix(SortBy): Adds id
prop to SortBy
, Select
components
#3068
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1a917c5:
|
✔️ Deploy Preview for react-instantsearch ready! 🔨 Explore the source changes: 573e698 🔍 Inspect the deploy log: https://app.netlify.com/sites/react-instantsearch/deploys/60dc96c8a074c00007b57a8a 😎 Browse the preview: https://deploy-preview-3068--react-instantsearch.netlify.app/storybook/iframe |
Thanks for your PR! I think this makes sense, since these controls otherwise are missing a label, but have a couple things that could be fixed before releasing:
As an alternative before releasing, you could wrap the SortBy in a label, and then no id is needed (this is how I usually fix it, as ids have to be globally unique, which isn't something you can guarantee with a component-based framework) |
Thank you for reviewing @Haroenv! 🙌
I added a test for the
I was planning on opening a few more PRs to add this
This is something my team and I debated a bit as well when we made this PR! We thought adding the |
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.
This seems good to go for me!
I'd like to release the three locations of ids in a single release, are you interested in making similar PRs for the other components? For SearchBox the name should probably be Thanks! |
Perfect, yes! I can push up those remaining PRs tomorrow |
const select = wrapper.find('select').getDOMNode(); | ||
expect(select.getAttribute('id')).toEqual(id); |
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.
this style of test looks good for the other two as well 👌
1a917c5
to
573e698
Compare
Summary
This PR adds an
id
prop to theSortBy
component, in order to associate the element with alabel
. To accomplish this, the PR also adds anid
prop to theSelect
componentResult
npm link
inpackages/react-instantsearch-dom
and root directory to sync package updateyarn watch
wasn't updating the component from the packageid
to the defaultSortBy
Storybook storyid
prop appears in DOMQuestions
SortBy
on the Algolia website to include the newid
prop?