Searching a lot about how to use the new :target with JS smooth scroll

Searching a lot about how to use the new :target with JS smooth scroll
0

#1

But there is not possible. As the preventDefault blocks the :target so is bad.
There have any other way? to create with JS when a user click on a href to id then for that container h2 tag like section name be highlighted? And it is for more sections?

Thanks.