Subscribe on changes!

Event keydown Redundant text object

avatar
Jun 10th 2021

Version

3.1.1

Reproduction link

https://new-issue.vuejs.org/?repo=vuejs/vue-next

Steps to reproduce

<div class="inline-block mr-4" :class="data.sizes[size]" v-for="(n, i) in len" :task-id="`ofcold-security-code-id-${i}`">
                <input
                    maxlength="1"
                    autocorrect="off"
                    autocomplete="off"
                    autocapitalize="off"
                    spellcheck="false"
                    type="text"
                    class="focus:outline-none border text-center w-full h-full rounded"
                    v-model="data.securityCode[n-1]"
                    @focus="setSelected"
                    @input.stop="inputEvent"
                    @keydown.stop="downEvent"
                    @keypress.stop="pressEvent"
                    @paste="pasteEvent(n-1, $event)"
                />
            </div>

function downEvent (event: KeyboardEvent)  {

            let parentNode = <HTMLDivElement>(<HTMLInputElement>event.target).parentNode;
            let keyCode: number = event.which || event.keyCode;
            let _sibling;
console.log(event.target.parentNode.previousSibling)

What is expected?

Filter out unnecessary objects Example: Text

What is actually happening?

Useless Text object appears when the event is triggered

avatar
Jun 10th 2021

Open a new issue with a proper bug report like asked in the new issue website. You can use sfc.vuejs.org for simple reproductions