Skip to content

Commit 5599b5f

Browse files
committed
Use @media for js detection
1 parent f50b4c6 commit 5599b5f

5 files changed

Lines changed: 5 additions & 11 deletions

File tree

hypha/apply/funds/templates/funds/application_base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ <h4>
126126
{% endif %}
127127
</div>
128128
</form>
129-
<p class="alert alert-error message-no-js js-hidden">
129+
<p class="hidden mt-4 alert alert-error noscript:block">
130130
{% trans "You must have Javascript enabled to use this form." %}
131131
</p>
132132
{% endif %}

hypha/apply/funds/templates/funds/applicationsubmission_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{% endfor %}
5151
</div>
5252
</form>
53-
<p class="alert alert-error message-no-js js-hidden">
53+
<p class="hidden alert alert-error noscript:block">
5454
{% trans "You must have Javascript enabled to use this form." %}
5555
</p>
5656
</div>

hypha/static_src/javascript/application-form.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
});
4747
}
4848

49-
// Remove the "no javascript" messages
50-
document.querySelector(".message-no-js").remove();
51-
5249
// Block multiple form submits.
5350
form.addEventListener("submit", function () {
5451
// Use setTimeout with 0 delay to ensure form submission begins

hypha/static_src/sass/components/_form.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@
234234
input[type="file"] {
235235
@extend %off-screen;
236236

237-
.no-js & {
238-
@extend %on-screen;
237+
@media (scripting: none) {
238+
display: block;
239239
}
240240
}
241241

hypha/templates/base.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% wagtail_site as current_site %}
33
{% get_current_language as LANGUAGE_CODE %}
44
{% get_current_language_bidi as LANGUAGE_BIDI %}
5-
<html class="h-full no-js" lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}">
5+
<html class="h-full" lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}">
66
<head>
77
{# TODO fallbacks if page is not defined e.g. for 404 page #}
88
<meta charset="utf-8">
@@ -33,9 +33,6 @@
3333
{% block extra_css %}{% endblock %}
3434
<link rel="stylesheet" href="{% static 'css/print.css' %}" media="print">
3535

36-
{% comment %}Detect if javascript is enabled; helps with styling{% endcomment %}
37-
<script>document.querySelector("html").classList.replace("no-js", "js")</script>
38-
3936
<!-- Nprogressbar -->
4037
<script defer src="{% static 'js/vendor/nprogress-2.0.0.min.js' %}"></script>
4138

0 commit comments

Comments
 (0)