amazon-chime-sdk-component-library-react icon indicating copy to clipboard operation
amazon-chime-sdk-component-library-react copied to clipboard

allow "ref" attribute support on elements

Open alpjor opened this issue 3 years ago • 3 comments

Along with the "Focusable" Interface suggested in https://github.com/aws/amazon-chime-sdk-component-library-react/issues/252, it would be nice if components supported adding of "ref" attributes so that parent components can call them for focusing and blurring

alpjor avatar Oct 21 '20 19:10 alpjor

Also for things like attaching to events via .addEventListener( etc.

alpjor avatar Oct 21 '20 20:10 alpjor

For any others arriving at this ticket, this is an enhancement we have backlogged to add ref support to all elements.

As an immediate workaround, you can always wrap the component with your own ref to access it

// use whatever browser API you prefer to grab the element
console.log(myRef.firstElementChild)

return (
 <div ref={myRef}>
   <SomeComponent />
 </div>
)

p-foucht avatar Jan 22 '21 22:01 p-foucht

Adding my vote for this as well. Ideally, I can pass in a onChange handler to the device selection components as a prop. Using a ref will address this as well though.

everscending avatar May 23 '22 17:05 everscending