In modern JavaScript development, event handling plays a crucial role in making web applications interactive and dynamic. As applications grow, so ...
For further actions, you may consider blocking this person and/or reporting abuse
CS on industry๐๐๐
Thank you for the great series here keep it going ๐
I'm so glad to hear that you found it helpful ๐๐
codeshubb.blogspot.com/2024/11/blo...
๐
Thank you Ali Raza...๐ค
Thank you!
I'm glad to know that you found it helpful๐๐๐
I don't know if it is bad practice but I like to attach my event listener to the root and delegate from there.
Attaching to the root is convenient for dynamic elements, but watch out for performance in large DOMs. If it works for you, go for it!๐ค
Good post!
Thaks for your appreciate๐
You can find best coding related courses and articles
codeshubb.blogspot.com/2024/11/blo...
Thanks for sharing๐
Keep in mind this is bad practice for assertive technologies such as screen readers as they'll announce those containers as clickable/interactable.
That's why it's not done today. People will be confused when they receive false information. Furthermore it's harder to debug certain things. When you have your event listeners attached directly to the element you can use your dev tools more effectively
Calling it 'bad practice' feels overly broad. Event delegation is widely used for efficiency and doesn't inherently compromise accessibility when implemented correctly. Screen readers won't misinterpret if proper ARIA roles and semantic HTML are used. Debugging issues? Only if you're not adept with your tools. This technique deserves nuance, not dismissal.