Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useActiveElement() not working #3799

Open
7 tasks done
imvimol opened this issue Feb 21, 2024 · 1 comment
Open
7 tasks done

useActiveElement() not working #3799

imvimol opened this issue Feb 21, 2024 · 1 comment

Comments

@imvimol
Copy link

imvimol commented Feb 21, 2024

Describe the bug

I am creating the shortcut using useMagicKeys() and useActiveElement() from vueuse;

const activeElement = useActiveElement();
const notUsingInput = computed(
() =>
activeElement.value?.tagName !== 'INPUT' &&
activeElement.value?.tagName !== 'TEXTAREA',
);
const keys = useMagicKeys();
const questionMarkPressed = keys['?'];
whenever(logicAnd(questionMarkPressed, notUsingInput), () => {
console.log("This is ? press outside the textarea");
});

i'm trying to use this logic to create shortcut of " ? " when we press " ? " outside the textarea something like that. But It doesn't seem work for me using this logic. Can someone help me ?

Reproduction

useMagicKeys() and useActiveElement()

System Info

useMagicKeys() and useActiveElement()

Used Package Manager

npm

Validations

@jaketig
Copy link
Contributor

jaketig commented Feb 27, 2024

This should be fixed now via #3815.

Here's a working example sample:

https://stackblitz.com/edit/vitejs-vite-qhfqvb?file=src%2FApp.vue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants