-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[core] Enable innerRef on Backdrop, List, MenuList and Paper #13722
[core] Enable innerRef on Backdrop, List, MenuList and Paper #13722
Conversation
This enabled by using withStyles innerRef in conjunction with forwardRef.
This was only needed for forwardRef but since displayName support is not really ready yet we don't need it anyway
} | ||
}); | ||
|
||
Backdrop.displayName = 'Backdrop'; |
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.
See facebook/react#14319 for full explanation.
It's a naive question. Do we need the forwardRef complexity if React ships reactjs/rfcs#97? |
It's an incomplete and open RFC. I don't know what your timeline is but if we want to be strict mode compatible in v4 then we not only have to delay indeterminately until the RFC is settled. We also have to wait for it to be implemented, released and use that version as a peer dependency. Those are quite a bit of unknowns. I'm not sure what you mean by complexity. The only complexity I can see right now is waiting for reactjs/react-docgen#311 to be released. I don't want to merge this right now. I'd rather wait for the docgen feature to be released than introduce patch-package. |
f5b94ed
to
1984ae7
Compare
With the release of @oliviertassinari Are you ok with merging this PR or do you want to wait for the fragment ref implementation? |
@eps1lon I don't have a strong feeling about each outcome.
|
Don't forget |
Required in MenuList and missed in mui#13722
Required in MenuList and missed in mui#13722
Required in MenuList and missed in #13722
Required in MenuList and missed in mui#13722
Enables
innerRef
onBackdrop
,List
,MenuList
andPaper
. These are the components where we currently are attaching refs forfindDOMNode
.This is step 1 in #13676 (comment) and a prerequisite for #13676.
patch-package
is only a temporary workaround until reactjs/react-docgen#311 gets merged. If it doesn't get merged before v4 I would suggest we use a fork instead of patching transpiled files.PS: I would hold off for now on forwarding refs for all components. I generally follow the argument that it's breaking component abstraction and we can always add forwarding refs later on if the use case makes sense. I would however also argue that forwarding refs on components that are clearly meant to render a DOM node (e.g. a
Button
orList
component) is not an issue as long we are defining the interface as basic as possible. For example defining that theref
onButton
returns abutton
HTML element will likely block us if we decide to use adiv
in the future. However saying that theref
is a generic HTML element is not bad at all in my opinion. Since react-dom does not support all use cases yet (e.g. focus or passive event listeners) we still need access to the actual DOM.