<commit_before>import React, { Component } from 'react';
import {MDCTextfield} from '@material/textfield/dist/mdc.textfield.js';
import {MDCDialog} from '@material/dialog/dist/mdc.dialog.js';

import '@material/form-field/dist/mdc.form-field.css';
import '@material/select/dist/mdc.select.css';
import '@material/textfield/dist/mdc.textfield.css';
import '@material/button/dist/mdc.button.css';
import '@material/dialog/dist/mdc.dialog.css';

import './ExpenseForm.css';

class ExpenseForm extends Component {
  constructor(props) {
    super(props);

    this.state = { isValid: false };

    this.handleInputChange = this.handleInputChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
    this.initializeDeleteModal = this.initializeDeleteModal.bind(this);
  }

  handleInputChange(event) {
    const target = event.target;

    target.reportValidity();
    this.setState({ isValid: this.form.checkValidity() });
    this.props.onChange(target.name, target.value);
  }

  componentDidMount() {
    document.querySelectorAll(".mdc-textfield").forEach((selector) => { new MDCTextfield(selector); });
  }

  handleSubmit(event) {
    event.preventDefault();
    this.props.onSubmit();
  }

  initializeDeleteModal(element) {
    if (element) {
      this.dialog = new MDCDialog(element);
      this.dialog.listen("MDCDialog:accept", () => { this.props.onDelete(this.props.expense); });
    }
  }
<commit_msg>Fix modal dialog locking the scroll after acceptance<commit_after>import React, { Component } from 'react';
import {MDCTextfield} from '@material/textfield/dist/mdc.textfield.js';
import {MDCDialog} from '@material/dialog/dist/mdc.dialog.js';

import '@material/form-field/dist/mdc.form-field.css';
import '@material/select/dist/mdc.select.css';
import '@material/textfield/dist/mdc.textfield.css';
import '@material/button/dist/mdc.button.css';
import '@material/dialog/dist/mdc.dialog.css';

import './ExpenseForm.css';

class ExpenseForm extends Component {
  constructor(props) {
    super(props);

    this.state = { isValid: false };

    this.handleInputChange = this.handleInputChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
    this.initializeDeleteModal = this.initializeDeleteModal.bind(this);
  }

  handleInputChange(event) {
    const target = event.target;

    target.reportValidity();
    this.setState({ isValid: this.form.checkValidity() });
    this.props.onChange(target.name, target.value);
  }

  componentDidMount() {
    document.querySelectorAll(".mdc-textfield").forEach((selector) => { new MDCTextfield(selector); });
  }

  handleSubmit(event) {
    event.preventDefault();
    this.props.onSubmit();
  }

  initializeDeleteModal(element) {
    if (element) {
      this.dialog = new MDCDialog(element);
      this.dialog.listen("MDCDialog:accept", () => {
        // a fix for not closing the modal dialog properly
        document.body.className = document.body.className.replace("mdc-dialog-scroll-lock","");
        this.props.onDelete(this.props.expense);
      });
    }
  }

{'fraction_non_alphanumeric': 0.1504569190600522, 'fraction_numerical': 0.0, 'mean_word_length': 4.151260504201681, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1311500', 'n_tokens_mistral': 959, 'n_tokens_neox': 949, 'n_words': 148}