问题
when the descendant node of the region with tabindex -1
(this is a modal dialog window) has a tag, in the macOS safari browser I needed the tabindex = '-1'
attribute to trigger the click event on the a tag.
However, this causes an issue where the modal scroll goes up when clicking the a tag.
The same issue occurred when adding the href = "javascript: void (0)"
attribute to the a tag and calling e.preventDefault()
inside a function that works when a tag click event is called.
<div tabindex="-1" role="dialog" aria-hidden="true">
<div class="scrollbox">
<a tabindex="-1" href="javascript:void(0);">click</a>
</div>
</div>
What is causing this problem? Is there a workaround in the current situation?
While looking for a solution, I also found the following issues, but did not find the answer I wanted. What's the tabindex="-1" in bootstrap for
来源:https://stackoverflow.com/questions/60631666/is-there-a-way-to-prevent-the-default-behavior-of-the-a-tag-with-the-tabindex