How to use the @react-md/utils.isFocusable function in @react-md/utils

To help you get started, we’ve selected a few @react-md/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mlaursen / react-md / packages / states / src / StatesConsumer.tsx View on Github external
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 */
      }
github mlaursen / react-md / packages / states / src / StatesConsumer.tsx View on Github external
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 */