Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public componentDidMount() {
if (!this.props.pressable) {
return;
}
this.el = ReactDOM.findDOMNode(this) as HTMLElement;
if (!isFocusable(this.el, true)) {
while (this.el && !isFocusable(this.el, true)) {
this.el = this.el.parentElement;
}
}
if (!this.el) {
if (process.env.NODE_ENV === "development") {
/* tslint:disable:no-console */
console.error(
"The `StatesConsumer` component was mounted without finding a valid " +
"HTMLElement as one of its children. This should be fixed before " +
"deploying to production as your element will have no focus, hover, " +
"or pressed styles applied."
);
console.error(new Error().stack);
/* tslint:enable:no-console */
}
public componentDidMount() {
if (!this.props.pressable) {
return;
}
this.el = ReactDOM.findDOMNode(this) as HTMLElement;
if (!isFocusable(this.el, true)) {
while (this.el && !isFocusable(this.el, true)) {
this.el = this.el.parentElement;
}
}
if (!this.el) {
if (process.env.NODE_ENV === "development") {
/* tslint:disable:no-console */
console.error(
"The `StatesConsumer` component was mounted without finding a valid " +
"HTMLElement as one of its children. This should be fixed before " +
"deploying to production as your element will have no focus, hover, " +
"or pressed styles applied."
);
console.error(new Error().stack);
/* tslint:enable:no-console */