CodePudding user response:
From this:
<a href="#" target="" title="">
Change to this (remove href="#"
and add tabIndex="0"
):
<a tabIndex="0" >
What href="#"
does is, it changes the URl by appending #
at the end of the url and that causes the browser to react and in your case it forces a page scroll to the top.
After you remove href
, the <a>
element will now act like an ordinary inline element like span without keyboard tab capabilities. So you must proceed to add tabIndex="0"
to make it tab-able in the case your viewer uses a keyboad.