How to use the focus-lock/constants.FOCUS_GROUP function in focus-lock

To help you get started, we’ve selected a few focus-lock 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-lock / src / Lock.js View on Github external
if (observed.current !== newObserved) {
      observed.current = newObserved;
      setObserved(newObserved);
    }
  }, []);

  if (process.env.NODE_ENV !== 'production') {
    if (typeof allowTextSelection !== 'undefined') {
      // eslint-disable-next-line no-console
      console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');
    }
  }

  const lockProps = {
    [constants.FOCUS_DISABLED]: disabled && 'disabled',
    [constants.FOCUS_GROUP]: group,
    ...containerProps,
  };

  const hasLeadingGuards = noFocusGuards !== true;
  const hasTailingGuards = hasLeadingGuards && (noFocusGuards !== 'tail');

  return (
    
      {hasLeadingGuards && [
        <div style="{hiddenGuard}" tabindex="{disabled" data-focus-guard="">, // nearest focus guard
        <div style="{hiddenGuard}" tabindex="{disabled" data-focus-guard="">, // first tabbed element guard
      ]}
      </div></div>