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

Fixed viewport meta-tags #2084

Merged
merged 3 commits into from
Jun 9, 2022
Merged

Conversation

AnnMarieW
Copy link
Collaborator

In dash 2.5.0, a default viewport meta tag was added as recommended for mobile-optimized sites by mdn.
This PR makes it so that this feature can be disabled by providing an empty viewport meta tag.
e.g. app = Dash(meta_tags=[{"name": "viewport"}])

Contributor Checklist

  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR
  • I have added entry in the CHANGELOG.md

# -3 for the meta charset, http-equiv and viewport.
assert len(meta) == 3, "Should have 3 meta tags"

viewport_meta = meta[2]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not to depend on the order of the returned meta elements. Also if we add more default meta tags in the future this test would need to change. Instead, find just the viewport tags and ensure there's exactly one:

meta = dash_duo.find_elements('meta[name="viewport"]')

@@ -133,6 +133,29 @@ def test_inin007_meta_tags(dash_duo):
assert meta_tag.get_attribute("content") == meta_info["content"]


def test_inin007b_change_viewport_meta_tag(dash_duo):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we not squeeze test numbers in between with b or such - makes it harder to run just one test with eg pytest -k inin007. Just shift some of the other test numbers so this one can have its own. Maybe the ones up front since this file starts at inin004?

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 Excellent!

@alexcjohnson alexcjohnson merged commit c12c957 into plotly:dev Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants