How to use @instructure/ui-a11y-utils - 8 common examples

To help you get started, we’ve selected a few @instructure/ui-a11y-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-buttons / src / Button / index.js View on Github external
buttonRef,
      children,
      cursor,
      disabled,
      href,
      icon,
      margin,
      onClick,
      readOnly,
      size,
      type,
      variant,
      tabIndex
    } = this.props

    const IHaveVisibleChildren = hasVisibleChildren(this.props.children)
    const hasTextAndIcon = IHaveVisibleChildren && this.props.icon // any button with an icon + text label
    const hasOnlyIcon = !IHaveVisibleChildren && this.props.icon // any button with just an icon visible

    if (process.env.NODE_ENV !== 'production') {
      // show warning if icon is added as a child
      if (this.hasVisibleChildren) {
        React.Children.forEach(children, (child) => {
          const icon = child && child.type && typeof child.type.glyphName !== 'undefined'
          warn(
            !icon,
            `[Button] Icons as children is deprecated. Please use the 'icon' prop instead.`
          )
        })
      }
    }
github instructure / instructure-ui / packages / ui-link / src / Link / index.js View on Github external
get hasVisibleChildren () {
    return hasVisibleChildren(this.props.children)
  }
github instructure / instructure-ui / packages / ui-navigation / src / Navigation / NavigationItem / index.js View on Github external
render () {
    const {
      minimized,
      label
    } = this.props

    const link = this.renderLink()

    return (
      minimized && hasVisibleChildren(label) ? (
        
          {link}
        
      ) : link
    )
  }
}
github instructure / instructure-ui / packages / ui-forms / src / Select / SelectField / index.js View on Github external
inputProps['aria-activedescendant'] = `${this._optionsId}_${highlightedOption.id}`
    } else {
      inputProps['aria-activedescendant'] = null
    }


    let wrappedLabel = (
      <label>
        {this.props.label}
      </label>
    )

    if (!hasVisibleChildren(this.props.label)) {
      wrappedLabel = {wrappedLabel}
    }

    return (
github instructure / instructure-ui / packages / ui-elements / src / Link / index.js View on Github external
get hasVisibleChildren () {
    return hasVisibleChildren(this.props.children)
  }
github instructure / instructure-ui / packages / ui-pagination / src / Pagination / index.js View on Github external
renderLabel () {
    const display = this.props.variant === 'compact' ? 'block' : 'inline-block'
    const visibleLabel = hasVisibleChildren(this.props.label)

    return (
      
    )
  }
github instructure / instructure-ui / packages / ui-menu / src / Menu / MenuItemGroup / index.js View on Github external
renderLabel () {
    const { label } = this.props

    return hasVisibleChildren(label) ? (
      <span>{label}</span>
    ) : label
  }
github instructure / instructure-ui / packages / ui-form-field / src / FormFieldLabel / index.js View on Github external
render () {
    const ElementType = getElementType(FormFieldLabel, this.props)

    const classes = {
      [styles.root]: true,
      [styles['has-content']]: hasVisibleChildren(this.props.children)
    }

    return (
      
        {this.props.children}
      
    )
  }
}

@instructure/ui-a11y-utils

A collection of utilities for managing focus and screen reader behavior

MIT
Latest version published 22 days ago

Package Health Score

87 / 100
Full package analysis

Popular @instructure/ui-a11y-utils functions

Similar packages