Do not allow caret positions outside spans.