Open DavidWittness opened 1 year ago
This would be a nice feature to add to the components.
A component like Video
feels unusable as you have to use native controls to interact with the video.
+1 this is an unusable component... Can we contribute to this or is it locked to only devs from Shopify? @andershagbard
+1 this is an unusable component... Can we contribute to this or is it locked to only devs from Shopify? @andershagbard
I'm not a Shopify employee, just a contributor. I've done a few PRs on this and had them merged, so everyone can help :)
@andershagbard which components are lacking in particular right now? We definitely welcome PRs.
Amazing @andershagbard & @blittle. Thanks for the responses.
@blittle I would say pretty much all lower level components that ultimately render single HTML elements like this would benefit from a forwardRef prop. That being said... React 19 is removing the need for it 😅 not sure when you would be supporting R19 but yeah... I guess this is a bit of a "just wait" sitch?
Agreed. We hope to get to React 19 sooner rather than later.
Screenshotted no take backsies 🤣 ... 😝
Looking forward to it. In the meantime I will avoid these lower level comps.
@andershagbard which components are lacking in particular right now? We definitely welcome PRs.
Most of them stilling missing forwardRefs. I did it for video components, as I needed them myself in a project. I would imagine all components could benefit from forwardRef
.
It's rather simple to update the components with full backward compatibility.
Feature request brought up by discussion around best practices with components that return HTML.
Context
Original DevDocs issue
Slack convo
Goal
We can't anticipate what our devs will need to do with our components. One way to provide an "escape hatch" from the React lifecycle. This allows for vanilla JS changes where necessary (even when not ideal).
One example may be to have custom focus controls based on a specific UI flow that is inherently not declarative. Good example near the bottom of this LogRocket article
If a user can access the DOM element, they will have access to native browser APIs and can use vanilla JS libraries.
Developer Experience
When documenting these components, make specific note of where
ref
can be used. If a component returns more than one HTML element, specify which element is "forwarded".