UNPKG

react-bootstrap-typeahead

Version:
15 lines (14 loc) 503 B
import isSelectable from './isSelectable'; export default function defaultSelectHint(e, selectHint) { let shouldSelectHint = false; if (e.key === 'ArrowRight') { shouldSelectHint = isSelectable(e.currentTarget) ? e.currentTarget.selectionStart === e.currentTarget.value.length : true; } if (e.key === 'Tab') { e.preventDefault(); shouldSelectHint = true; } return selectHint ? selectHint(shouldSelectHint, e) : shouldSelectHint; }