Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta_viewport rule fails to find viewport element inside block #28

Open
thibaudcolas opened this issue Sep 18, 2020 · 0 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@thibaudcolas
Copy link
Owner

Describe the bug

The base.html of the Django admin has a textbook accessibility fail – disabling zooming for mobile users: https://github.com/django/django/blob/278b6187d2a6711afb0b35dc5c3c09fe5be9adb3/django/contrib/admin/templates/admin/base.html#L15

This is what the meta_viewport rule is meant to pick up, unfortunately it doesn’t pick it up.

Which terms did you search for in the documentation and issue tracker?

viewport, meta, user-scalable

Environment

$ curlylint --version
curlylint, version 0.12.0

macOS Catalina

Steps to reproduce

  1. Save https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base.html#L15 locally.
  2. curlylint --rule 'meta_viewport: true' admin/templates/admin/base.html

Expected behavior

$ curlylint --rule 'meta_viewport: true' admin/templates/admin/base.html
admin/templates/admin/base.html
14:1	Remove `user-scalable=no` from the viewport meta so users can zoom	meta_viewport

Oh no! 💥 💔 💥
1 error reported

Actual behavior

$ curlylint --rule 'meta_viewport: true' admin/templates/admin/base.html
All done! ✨ 🍰 ✨

The problem seems to be with the meta tag being inside of a block:

{% block responsive %}
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}">
    {% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive_rtl.css" %}">{% endif %}
{% endblock %}

Moving it out of the block, the issue is picked up correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant