function getItemAndIndex(itemProp, indexProp, items, errorMessage) {
  let item, index

  if (itemProp === undefined) {
    if (indexProp === undefined) {
      throw new Error(errorMessage)
    }

    item = items[indexProp]
    index = indexProp
  } else {
    index = indexProp === undefined ? items.indexOf(itemProp) : indexProp
    item = itemProp
  }

  return [item, index]
}
Debounced call for updating the a11y message.