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
Checkbox: Add forward ref (BREAKING CHANGE) #1057
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploy preview for gestalt ready! Built with commit 01a5eaa |
Deploy preview for gestalt ready! Built with commit fa3f23b |
AlbertCarreras
force-pushed
the
checkbox
branch
2 times, most recently
from
July 17, 2020 01:53
7dd6f16
to
519eee2
Compare
AlbertCarreras
commented
Jul 17, 2020
christianvuerings
approved these changes
Jul 17, 2020
@@ -104,7 +113,7 @@ export default function Checkbox({ | |||
marginRight={-1} | |||
> | |||
<Label htmlFor={id}> | |||
<Box paddingX={1} position="relative"> |
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 position relative is need as the input element is position absolute
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
We have use cases in the Pinterest codebase where we set a ref on a wrapping container for Checkbox in order to anchor other components on it.
To abstract this implementation, let's add a way for them to get it in a dryer way.
Moreover, without forwardedRefs, refs are set on the component's instance, not the actual input. So in each of those cases, people drill down to get the .
That is pretty hacky, so let's add a way for them to get it in a cleaner way.
Why is this a breaking change?
https://reactjs.org/docs/forwarding-refs.html#note-for-component-library-maintainers
Can I get more documentation around this feature?
https://reactjs.org/docs/forwarding-refs.html#forwarding-refs-to-dom-components
Test Plan
* Is it accessible?* Have you involved other stakeholders (such as a Pinterest Designer)?