Skip to content

Prevent long reference URLs from overflowing mobile article content #604

Description

@georgeolaru

Problem

Long visible reference URLs inside post-content links can make a narrow page wider than its physical viewport. Readers must scroll sideways even though the paragraph and reading-track boxes have the correct width.

Observed in Anima LT 2.0.49 (source 09acef4d38734b313e48b771f5d4f2e571e7224e), with Nova Blocks and Style Manager active, in isolated Chrome mobile/touch contexts. Customer content and private screenshots are intentionally omitted.

Reproduction

  1. Use an Anima LT single-post template that renders Core Post Content.
  2. In a normal paragraph, add a reference link whose visible text is the URL and whose final path segment is long and unbroken. Suggested content-only fixture:
<!-- wp:paragraph -->
<p>Reference: <a href="https://example.org/references/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz">https://example.org/references/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz</a></p>
<!-- /wp:paragraph -->
  1. Load the frontend in a fresh 320px mobile/touch viewport; also test 390px. Do not resize from desktop first.
  2. Compare the requested physical width with both window.innerWidth and document.documentElement.scrollWidth. Inspect the link's inline fragments as well as the paragraph box. An expanded mobile layout viewport must not be mistaken for a pass.

The fixture above is suggested reproduction content, not a newly persisted test post. Actual observed article measurements:

Anonymous sample Requested width Document scroll width Paragraph width
A 390px 421px 348.5px
A 320px 415px 280px
B 320px 352px 280px
C 320px 381px 280px

The same three samples at both mobile widths give six targeted cases; four fail before the candidate rule. All samples have correct-width paragraph boxes. Their normal desktop reading layouts do not have the same overflow.

Diagnosis and tested candidate

The overflow is in long unbreakable inline link text, not an oversized paragraph, grid or font setting. Native Core typography/layout controls do not expose a wrapping attribute for this problem.

A disposable-DOM rule makes all six targeted mobile cases fit their requested physical width while preserving paragraph measure, font size, exact text and hrefs:

.entry-content a {
  overflow-wrap: anywhere;
}

Proposed source owner: src/scss/elements/_links.scss. Keep the scope to article-content links; do not use a global word-break: break-all, hide overflow, rewrite URLs, shrink typography, or hand-edit compiled stylesheets. Confirm the appropriate editor content scope before choosing the final selector.

This is a measured candidate, not an implemented or released fix. No theme source, generated build or persistent site content was changed during the proof.

Acceptance criteria

  • Long visible reference URLs fit 320px and 390px physical viewports in fresh mobile/touch contexts; verify requested width, inner width and document width.
  • Normal desktop article measure and ordinary words are unchanged; no new within-word splitting in surrounding prose.
  • Exact stored article text, link text and hrefs remain unchanged; linked references still work.
  • Frontend and relevant editor content scopes have equivalent readable behavior, without affecting navigation, cards, buttons or unrelated headings.
  • Add an automated regression fixture demonstrating failure without the rule and success with it; retain the pre-fix measurements.
  • Change source SCSS and verify generated commercial/LT output through the normal build workflow; do not patch compiled CSS directly.

Issue filing does not establish source implementation, package verification or release readiness.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions