<commit_before>function scrollList(resultList, index) {
  const resultEl = resultList[index];
  resultEl.scrollIntoView({ block: "end", behavior: "smooth" });
}

function handleKeyDown(e: SyntheticKeyboardEvent) {<commit_msg>add chrome scroll polyfill (#2202)<commit_after>const { isFirefox } = require("devtools-config");

function scrollList(resultList, index) {
  const resultEl = resultList[index];

  if (isFirefox()) {
    resultEl.scrollIntoView({ block: "end", behavior: "smooth" });
  } else {
    chromeScrollList(resultEl, index);
  }
}

function chromeScrollList(elem, index) {
  const resultsEl = elem.parentNode;
  if (!resultsEl || resultsEl.children.length === 0) {
    return;
  }

  const resultsHeight = resultsEl.clientHeight;
  const itemHeight = resultsEl.children[0].clientHeight;
  const numVisible = resultsHeight / itemHeight;
  const positionsToScroll = index - numVisible + 1;
  const itemOffset = resultsHeight % itemHeight;
  const scroll = positionsToScroll * (itemHeight + 2) + itemOffset;

  resultsEl.scrollTop = Math.max(0, scroll);
}

function handleKeyDown(e: SyntheticKeyboardEvent) {
{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.008021390374331552, 'mean_word_length': 5.238888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1970534', 'n_tokens_mistral': 350, 'n_tokens_neox': 335, 'n_words': 79}