<commit_before>const React = require('react');
const {
  getFocusableNodesInElement,
  reconcileNodeArrays,
  setNodeAttributes
} = require('utils/FocusManagement');

module.exports = class RestrictFocus extends React.Component {
  constructor (props, context) {
    super(props, context);

    this._wrapper = React.createRef();
    this.focusableDOMNodes = [];
  }

  componentDidMount () {
    const focusableNodesInDocument = getFocusableNodesInElement(document);
    const focusableNodesInWrapper = getFocusableNodesInElement(this._wrapper);

    this.focusableDOMNodes = reconcileNodeArrays(
      focusableNodesInDocument,
      focusableNodesInWrapper
    );

    this.focusableDOMNodes.forEach(node => {
      setNodeAttributes(node, { tabindex: -1, 'aria-hidden': true });
    });

    console.log('DidMount Test', {
      focusableNodesInDocument,
      focusableNodesInWrapper,
      focusableDOMNodes: this.focusableDOMNodes
    });
  }

  componentWillUnmount () {
    this.focusableDOMNodes.forEach(node => {
      setNodeAttributes(node, { tabindex: 0, 'aria-hidden': false });
    });
  }

  render () {
    return (
      <div ref={ref => this._wrapper = ref}>
        {this.props.children}
      </div>
    );
  }
};<commit_msg>Pass props onto wrapping div<commit_after>const React = require('react');
const {
  getFocusableNodesInElement,
  reconcileNodeArrays,
  setNodeAttributes
} = require('utils/FocusManagement');

module.exports = class RestrictFocus extends React.Component {
  constructor (props, context) {
    super(props, context);

    this._wrapper = React.createRef();
    this.focusableDOMNodes = [];
  }

  componentDidMount () {
    const focusableNodesInDocument = getFocusableNodesInElement(document);
    const focusableNodesInWrapper = getFocusableNodesInElement(this._wrapper);

    this.focusableDOMNodes = reconcileNodeArrays(
      focusableNodesInDocument,
      focusableNodesInWrapper
    );

    this.focusableDOMNodes.forEach(node => {
      setNodeAttributes(node, { tabindex: -1, 'aria-hidden': true });
    });

    console.log('DidMount Test', {
      focusableNodesInDocument,
      focusableNodesInWrapper,
      focusableDOMNodes: this.focusableDOMNodes
    });
  }

  componentWillUnmount () {
    this.focusableDOMNodes.forEach(node => {
      setNodeAttributes(node, { tabindex: 0, 'aria-hidden': false });
    });
  }

  render () {
    return (
      <div ref={ref => this._wrapper = ref} {...this.props}>
        {this.props.children}
      </div>
    );
  }
};
{'fraction_non_alphanumeric': 0.1196039603960396, 'fraction_numerical': 0.0015841584158415843, 'mean_word_length': 3.55956678700361, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3844702', 'n_tokens_mistral': 750, 'n_tokens_neox': 736, 'n_words': 123}