How to use the @instructure/ui-dom-utils.requestAnimationFrame function in @instructure/ui-dom-utils

To help you get started, we’ve selected a few @instructure/ui-dom-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 instructure / instructure-ui / packages / ui-a11y / src / KeyboardFocusRegion.js View on Github external
handleFocus = event => {
    if (this._needToFocus) {
      this._needToFocus = false

      if (!this._contextElement) {
        return
      }

      // need to see how jQuery shims document.on('focusin') so we don't need the
      // setTimeout, firefox doesn't support focusin, if it did, we could focus
      // the element outside of a setTimeout. Side-effect of this implementation
      // is that the document.body gets focus, and then we focus our element right
      // after, seems fine.
      this._raf.push(
        requestAnimationFrame(() => {
          if (containsActiveElement(this._contextElement)) {
            return
          }
          this.focusDefaultElement()
        })
      )
    }
  }
github instructure / instructure-ui / packages / ui-elements / src / Rating / RatingIcon / index.js View on Github external
fill = () => {
    this._animation = requestAnimationFrame(() => {
      this.setState({
        filled: true
      })
    })
  }
github instructure / instructure-ui / packages / ui-a11y / src / Dialog / index.js View on Github external
open () {
    const {
      open,
      contentElement,
      ...options
    } = this.props

    this._raf.push(requestAnimationFrame(() => {
      this._focusRegion = FocusRegionManager.activateRegion(this.contentElement, {
        ...options
      })
    }))
  }
github instructure / instructure-ui / packages / ui-a11y / src / KeyboardFocusRegion.js View on Github external
focus () {
    if (this.focused) {
      return
    }

    this._raf.push(
      requestAnimationFrame(() => {
        this.focusDefaultElement()
      })
    )
  }
github instructure / instructure-ui / packages / ui-popover / src / Popover / index.js View on Github external
handleTriggerBlur = (event) => {
    if (this.props.on.indexOf('focus') > -1) {
      this._raf.push(requestAnimationFrame(() => {
        if (!containsActiveElement(this._view)) {
          this.hide(event)
        }
      }))
    }
  }