How to use aria-hidden - 5 common examples

To help you get started, we’ve selected a few aria-hidden 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 theKashey / react-focus-on / src / component.tsx View on Github external
private onActivation = (node: HTMLElement) => {
    this._undo = hideOthers(
      [node, ...(this.props.shards || []).map(extractRef)],
      document.body,
      this.props.noIsolation ? undefined : focusHiddenMarker
    );
    const {onActivation} = this.props;
    if (onActivation) {
      onActivation(node);
    }
    document.addEventListener('keyup', this.onKeyPress);
    document.addEventListener('click', this.onClick);
  };
github chakra-ui / chakra-ui / packages / chakra-ui-hooks / src / useAriaHidden.tsx View on Github external
useEffect(() => {
    let undoAriaHidden: Undo | null = null;
    let mountNode = mountRef.current;

    if (isOpen && canUseDOM && mountRef.current && container) {
      mountRef.current.id = id;
      container.appendChild(mountRef.current);
      if (isEnabled && mountNode) {
        undoAriaHidden = hideOthers(mountNode);
      }
    }

    return () => {
      if (isEnabled && undoAriaHidden != null) {
        undoAriaHidden();
      }
      if (mountNode && mountNode.parentElement) {
        mountNode.parentElement.removeChild(mountNode);
      }
    };
  }, [isOpen, id, isEnabled, container]);
github chakra-ui / chakra-ui / packages / chakra-ui-hooks / src / useModal / utils / useAriaHidden.tsx View on Github external
React.useEffect(() => {
    if (!ref.current) return;

    let undoAriaHidden: AriaHidden.Undo | null = null;
    let elementNode = ref.current;

    if (shouldActivate && elementNode) {
      undoAriaHidden = AriaHidden.hideOthers(elementNode);
    }

    return () => {
      if (shouldActivate && undoAriaHidden != null) {
        undoAriaHidden();
      }
    };
  }, [shouldActivate, ref]);
}
github theKashey / react-focus-on / src / Effect.tsx View on Github external
const onNodeActivation = (node: HTMLElement) => {
      _undo = hideOthers(
        [node, ...(shards || []).map(extractRef)],
        document.body,
        noIsolation ? undefined : focusHiddenMarker
      );

      setActiveNode(() => node);
    };
github chakra-ui / chakra-ui / packages / chakra-ui / src / Modal / index.js View on Github external
useEffect(() => {
    let undoAriaHidden = null;
    let mountNode = mountRef.current;

    if (isOpen && canUseDOM) {
      mountRef.current.id = id;
      container.appendChild(mountRef.current);
      if (enableInert) {
        undoAriaHidden = hideOthers(mountNode);
      }
    }

    return () => {
      if (enableInert && undoAriaHidden != null) {
        undoAriaHidden();
      }
      if (mountNode.parentElement) {
        mountNode.parentElement.removeChild(mountNode);
      }
    };
  }, [isOpen, id, enableInert, container]);

aria-hidden

Cast aria-hidden to everything, except...

MIT
Latest version published 1 month ago

Package Health Score

77 / 100
Full package analysis

Popular aria-hidden functions