code: function updatePossibleNavigations(element) {
    let canSelectNext;
    let canSelectPrevious;
    const items = element.items;
    if (items == null || items.length === 0) {
      // No items to select.
      canSelectNext = false;
      canSelectPrevious = false;
    } if (element.selectionWraps) {
      // Since there are items, can always go next/previous.
      canSelectNext = true;
      canSelectPrevious = true;
    } else {
      const index = element.selectedIndex;
      if (index < 0 && items.length > 0) {
        // Special case. If there are items but no selection, declare that it's
        // always possible to go next/previous to create a selection.
        canSelectNext = true;
        canSelectPrevious = true;
      } else {
        // Normal case: we have an index in a list that has items.
        canSelectPrevious = (index > 0);
        canSelectNext = (index < items.length - 1);
      }
    }
    if (element.canSelectNext !== canSelectNext) {
      element.canSelectNext = canSelectNext;
    }
    if (element.canSelectPrevious !== canSelectPrevious) {
      element.canSelectPrevious = canSelectPrevious;
    }
  }
docs: Following a change in selection, report whether it's now possible to go next/previous from the given index.