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

just a tip #248

Open
VladyslavKvaskov opened this issue Apr 13, 2024 · 0 comments
Open

just a tip #248

VladyslavKvaskov opened this issue Apr 13, 2024 · 0 comments

Comments

@VladyslavKvaskov
Copy link

VladyslavKvaskov commented Apr 13, 2024

https://github.com/ynshung/better-yt-shorts/blame/c3c039b4e868d2330c653fdd6105d7c93d607e87/src/lib/handleKeyEvent.ts#L21-L29
image

This logic looks weird. Just check if the actual activeElement is an input or has the attribute "contenteditable". No need to get all the inputs and contenteditable elements to check if they contain the activeElement.

if (
     document.activeElement && 
    (document.activeElement.tagName.toLowerCase() === 'input' || document.activeElement.hasAttribute('contenteditable'))
)

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

No branches or pull requests

1 participant