src/mixins/multipleSelection.js
/**
     * Handler when the user focus on a tag
     */
Handler when the user focus on a tag
Handler when the user focus on a tag
focusTagHandler({ event = {}, tagName }) {
      this.focusedTagIndex = this.selectedTags.indexOf(tagName);
      const target = event.relatedTarget;
      if (
        target
        && target.matches('input')
        && this.shiftKey
        && !this.metaKey
        && !this.tabbing
        && this.$refs.input.selectionEnd !== 0
      ) {
        this.selectInputTextToTags();
        this.selectRangeActiveTags();
        return;
      }
      this.selectTagsPressingShift();
    }
focusTagHandler ( { event = { } , tagName } ) { this . focusedTagIndex = this . selectedTags . indexOf ( tagName ) ; const target = event . relatedTarget ; if ( target && target . matches ( 'input' ) && this . shiftKey && ! this . metaKey && ! this . tabbing && this . $refs . input . selectionEnd !== 0 ) { this . selectInputTextToTags ( ) ; this . selectRangeActiveTags ( ) ; return ; } this . selectTagsPressingShift ( ) ; }
Handler when the user focus on a tag
Handler when the user focus on a tag
// Update focusedTagIndex with the current value // relatedTarget tells from where the focus element comes from // If user clicks on a tag after being focus on the input // TODO: Might need to make it match the exact input, not any generic input // We select from the exact input text to the tags // We select the tags // We select range of tags using the shiftKey on focus so it works for // mouse and keyboard focus