
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!
I'm glad to know that you found it helpfulπππ
π
Thank you Ali Raza...π€
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!π€
You can find best coding related courses and articles
codeshubb.blogspot.com/2024/11/blo...
Thanks for sharingπ
Good post!
Thaks for your appreciateπ
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.