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

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?