Dev.to WebDev 🛠 Dev 👁 0 📖 6 min read

Three of our four product demos bleed off the right edge of a phone on purpose, and that puts every price off screen

Notifio's home page does not show screenshots of the desktop app. It shows four animated mockups that act out the app working: a rental site with new listings appearing, the tray app finding one, the alert email arriving

Notifio's home page does not show screenshots of the desktop app. It shows four animated mockups that act out the app working: a rental site with new listings appearing, the tray app finding one, the alert email arriving, and an auto-reply being sent. I have written about how they are built and about what 997 lines of them cost.

What I had never done is look at them on a phone with a ruler. So I loaded all 38 pages of the site at 320, 360, 390 and 430 CSS pixels and measured every element's right edge against the viewport.

The site is fine. The demos are not.

width   pages scrolling sideways   elements past the right edge   scrollable containers
 320            1 of 38                        112                         0
 360            0 of 38                         90                         0
 390            0 of 38                         85                         0
 430            0 of 38                         35                         0

No page has a horizontal scrollbar except one, which I will come back to. But "no horizontal scrollbar" is not the same as "nothing is off screen". It can also mean the overflow is clipped, and clipped is worse: a reader who scrolls sideways at least gets to see the content.

Here is the markup responsible. The comment above it reads "mobile: left + bottom padding, bleeds right", so this was a decision rather than an accident:

<div className={`w-full md:w-[560px] ...`}>
  <div className="overflow-hidden md:overflow-visible md:px-6 md:py-10">
    <div className="pl-6 pb-8 pt-0 md:pl-0 md:pb-0 min-w-[480px] md:min-w-0">
      {demo}
    </div>
  </div>
</div>

Three of the four demos render through that wrapper. A 480 pixel minimum width inside an overflow-hidden box means the mockup keeps its desktop proportions on a phone and runs off the edge, which is a reasonable visual idea: a window that continues past the screen reads as a real window rather than a squashed one.

Measured, it comes out like this:

viewport   mockup box        visible    lost
   320     x=17 → x=497      63.1%     177px
   390     x=17 → x=497      77.7%     107px
   430     x=17 → x=497      86.0%      67px
   540     x=17 → x=523     100.0%       0

The min-w-[480px] only bites while the available width is under about 504 pixels. Above that w-full wins and nothing is lost. Below it, which is every phone held in portrait, between a fifth and a third of each mockup is cut off and there is no way to see it: the parent is overflow-hidden, not overflow-x-auto, and across all 38 pages at all four widths there is not one horizontally scrollable container on the site.

What is in the missing 107 pixels

This is the part that turned a styling note into something worth fixing. I sampled the three mockups every three seconds for 18 seconds, so that the animation loops could not hide anything, and recorded the position of every price and every button at 390 pixels.

element                       left   right    at 390px
listings demo  €895/mo         420     467    off screen
               €1,150/mo       413     467    off screen
               €780/mo         421     467    off screen
               €1,650/mo       411     467    off screen
email demo     "View" button   ~410    467    off screen
               "Mon 09:15"     ~415    467    off screen
auto-reply     "Send"/"Sent"   408     467    off screen
hero demo      "Stop" button   282     336    visible

Every price in the mockup of a rental site is off screen. The call to action in the mockup of our alert email is off screen. The send button in the mockup of the auto-reply is off screen. They are all right-aligned inside a 480 pixel window, so they cluster at x=467 and the viewport ends at 390.

The page is selling one idea, which is that you find out about a listing before anybody else does. On a phone, the mockup of the listing has no price in it, and the two mockups of us acting on the listing have no visible action. The hero demo escapes because it is the one that is not in the bleed wrapper: it is 358 pixels wide at this viewport and its "Stop" button sits comfortably inside the screen.

The best detail is inside the email mockup, because part of it was already fixed. The macOS notification card that slides in over the mail window is positioned top-3 left-3 md:left-auto md:right-3: on a desktop it sits at the top right of the window, and under 768 pixels it jumps to the left edge instead.

notification card at 1280px    x=668 → x=888    visible
notification card at  390px    x=54  → x=274    visible
"View" button at      390px    x=410 → x=467    off screen

Both of those are in the same component. Somebody hit this problem once, solved it for the one element they were looking at with a single Tailwind prefix, and never asked what else in the same window was sitting at x=467. I know that, because I am somebody.

The one page that does scroll sideways, and the one word responsible

At 320 pixels, exactly one of the 38 pages has scrollWidth greater than clientWidth, by nine pixels: the ImmobilienScout24 alerts page. The cause is not a layout bug, it is a dictionary problem.

h1 text    "ImmobilienScout24 alerts when you are not paying for SuchenPlus"
font       Space Grotesk, 34px
column     272px  (320 viewport minus px-6 either side)
line box   304.8px wide, right edge at 328.8

"ImmobilienScout24" is one unbreakable word that renders 305 pixels wide at the h1 size, so it overhangs its own column by 33 and takes the document with it. It is the longest word on a site that names fifteen rental portals, and it is the only reason any page on the site scrolls horizontally at any width. Every other long name on the sites hub has a space or a hyphen in it: "WG-Gesucht", "Facebook Marketplace", "HousingAnywhere" at 15 characters is the runner-up and it fits.

The fixes, and why the obvious one does not work here

The textbook fix for a too-wide block on a phone is to let the reader swipe it:

.wrapper { overflow-x: auto; }

That does not work on this site, because of something in globals.css that I put there for unrelated reasons:

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
}

Every scrollbar on the site is hidden. A swipeable mockup would be swipeable with no indication whatsoever that it is, which is a worse failure than clipping: at least clipping looks intentional. Making this fix work means exempting one container from that global rule, which is the kind of CSS exception that outlives the reason for it.

So, in the order I will actually do them:

  1. Mirror the layout under md. The right-hand column of each mockup is where the price, the View and the Send live. The left-hand column is descriptive text a reader can guess at. Bleeding the left and pinning the right costs nothing and saves everything worth seeing.
  2. Scale instead of clip. transform: scale(0.78) with transform-origin: top left fits a 500 pixel mockup into 390 and keeps all of it. The cost is honest: the 11 pixel labels inside become 8.6 pixel labels, which is too small to read but not too small to recognise as a price next to a room.
  3. overflow-wrap: anywhere on the h1s. Nine pixels of sideways scroll on one page is nearly nothing, but it is nothing shared with a page whose entire job is ranking for one long German brand name.

If you want to see it, the measurement needs no tools: open the home page on a phone, or pull a desktop window in to about 400 pixels wide, and scroll to the three mockups below the hero. Everything you can see there is deliberate, and so is everything you cannot. The same page at full width, and the download page it is trying to get you to, are what the mockups look like when nothing is missing.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.