Open edwh opened 4 years ago
(Answering my own question.)
I can make this work by:
Then vue-at prevents the event propagating up to the level of my new div so it's not fired for me.
I'm using it on a textarea. vue-at detects the enter key and uses it to select a user. However I also want to detect the enter key in my textarea, and do something in that case.
Is there a nice way to prevent the enter event bubbling up if vue-at has handled it?
@edwh hi, sorry for the late reply !! It's great for you to find out a solution.
However I can find e.stopPropagation()
already in handleKeydown
:
https://github.com/fritx/vue-at/blame/a1de3170e69d09cc54dabebb1ff03cbe7cd82225/src/At.vue#L250
Maybe you need stopImmediatePropagation?
On 29 November 2022 07:17:02 GMT, Fritz Lin @.***> wrote:
I'm using it on a textarea. vue-at detects the enter key and uses it to select a user. However I also want to detect the enter key in my textarea, and do something in that case.
Is there a nice way to prevent the enter event bubbling up if vue-at has handled it?
@edwh hi, sorry for the late reply !! It's great for you to find out a solution. However I can find
e.stopPropagation()
already inhandleKeydown
: https://github.com/fritx/vue-at/blame/a1de3170e69d09cc54dabebb1ff03cbe7cd82225/src/At.vue#L250-- Reply to this email directly or view it on GitHub: https://github.com/fritx/vue-at/issues/113#issuecomment-1330188090 You are receiving this because you were mentioned.
Message ID: @.***>
I can make this work by:
- Switching my code to use keydown (vue-at uses keydown).
- Wrapping the in a div and moving my keydown event to that div rather than being on the textarea itself.
Maybe you need stopImmediatePropagation?
Ah yes, I can understand now.
I've never noticed stopImmediatePropagation
before, and I think it is fine to work lol:
https://github.com/search?q=%22.stopImmediatePropagation%28%29%22&type=code
Hi there - very useful library.
I'm using it on a textarea. vue-at detects the enter key and uses it to select a user. However I also want to detect the enter key in my textarea, and do something in that case.
Is there a nice way to prevent the enter event bubbling up if vue-at has handled it?
Alternatively, I was wondering if I could use events to spot when vue-at is active, and disable my function in that case. But there doesn't seem to be an event when closePanel is called.