Create and initialise default ref prop for Startdust components #417
Description
Feature Request
Create default ref for Startdust components that should point to the first DOM Element in the renderComponent.
Problem description
While developing the Dropdown component and using other Stardust components, I've used Input and List and had to manually expose refs for those components in order to use them in the Dropdown implementation (input focus, list passed to Downshift).
Proposed solution
A default ref prop should be added for each component probably in the renderComponent and initialised with the first DOMElement from the render function. (the List should've had the ElementType <ul>
).
This ref prop should also be easy to override in case we want custom behaviour.
This default ref prop should not impact the addition of other ref-like props. For instance, in Input, we can still have the inputRef pointing to the <input>
and the default ref pointing to the <div>
enclosing it.