I think you can simply use "pointer-events: none" on these childs and remove this code