How to use the @instructure/ui-dom-utils.findFocusable 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-focusable / src / Focusable / index.js View on Github external
get focusable () {
    let focusable = findFocusable(this, () => true, true) || []
    const focusableCount = focusable && focusable.length || 0

    warn(focusableCount === 1, `[Focusable] Exactly one focusable child is required (${focusableCount} found).`)

    focusable = focusable ? focusable[0] : false

    if (focusable && typeof focusable.focus === 'function')  {
      return focusable
    } else {
      return false
    }
  }