Anyone have suggestions on how to focus a button in react DetailsList? Refs seem like the way to go, and I'd like to do something like this:
findDOMNode<HTMLButtonElement>(this.refs.mybutton).focus()
But I haven't been able to get a ref handle on the button element.
One approach I've tried is in my DetailsList:
<DetailsList
onRenderItemColumn={this.renderItemColumn}
ref={(list) => {this.detailsList = list;}}
....
/>
And the button I want to focus (coming from renderItemColumn):
<PrimaryButton
onClick={() => this.handleActionSelection(fieldContent)}
ariaDescription={buttonText}
text={buttonText}
ref={"ButtonIWantToFocus"}
/>
In didComponentMount() I can now get access to the DetailList, but I'm not sure how to get the button ref to focus.
Alternatively I can define the button as:
<PrimaryButton
disabled={true}
ariaDescription={buttonText}
text={buttonText}
ref={(button) => {this.focusButton = button;}}
/>
This give me a handle to the button, but it has no focus(), function.
Thanks for your ideas.