Skip to content

Commit 5959673

Browse files
committed
Do not scroll to top when clicking challenge tabs
f6b731d introduced a `href` attribute on the anchors used as Bootstrap tabs. As there is nothing in JS preventing the default click action, this causes this page to scroll to top (sorry). A simple fix would be to use `@onclick.prevent` with AlpineJS, but a cleaner fix is to use button elements. Using anchors as tabs does not really make sense here as users don't need to drag&drop the anchor.
1 parent 9935b6f commit 5959673

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

templates/challenge.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
<ul class="nav nav-tabs">
99
<li class="nav-item">
10-
<a class="nav-link active" href="#" data-bs-target="#challenge" @click="showChallenge()">
10+
<button class="nav-link active" data-bs-target="#challenge" @click="showChallenge()">
1111
{% trans %}Challenge{% endtrans %}
12-
</a>
12+
</button>
1313
</li>
1414

1515
{% block solves %}
1616
<li class="nav-item">
17-
<a class="nav-link challenge-solves" href="#" data-bs-target="#solves" @click="showSolves()">
17+
<button class="nav-link challenge-solves" data-bs-target="#solves" @click="showSolves()">
1818
{% if solves != None %}
1919
{{ ngettext("%(num)d Solve", "%(num)d Solves", solves) }}
2020
{% endif %}
21-
</a>
21+
</button>
2222
</li>
2323
{% endblock %}
2424
</ul>

0 commit comments

Comments
 (0)