Similar to the D8 bug #1973456: .element-invisible on element at right causes horizontal scrollbar on desktop or right gap on phone on webkit browsers but more subtle. Occurs in webkit browsers including Android and iPad Safari.

A read more link has .element-invisible and is often set to float right. The default home page feed /node has such a read more link so is ideal to see the bug.

It's easiest to see the bug in a site with a responsive theme where the page width becomes equal to the screen width on mobile (temporary site with a demo of the bug here). I didn't manage to reproduce it on Bartik.

Navigate to the default feed. The page looks 100% correct (see screenshot ...600.png). However if you drag the page to the right, it will scroll 20-30 pixels (screenshot ...544.png). This shouldn't happen on this sort of responsive theme - and it doesn't when the read more link isn't present.

The patch from the related issue solves this issue too. I didn't take the Bartik lines, just these:

.element-invisible {
width: 1px;
}

.element-invisible.element-focusable:active, .element-invisible.element-focusable:focus {
width: auto;
}

Comments

AdamPS created an issue. See original summary.

adamps’s picture

NB With that particular web page example, the bug only appears on a smaller screen - not my Nexus 7 (maybe <=768px??).

I can upload a patch if there is any interest.

mgifford’s picture

The patch you used is based on #1973456: .element-invisible on element at right causes horizontal scrollbar on desktop or right gap on phone on webkit browsers right? If so, let's first figure out if this has affected anyone else.

geerlingguy’s picture

Status: Active » Needs review
StatusFileSize
new317 bytes

Eesh, I just spent about an hour and a half debugging this in a D7 theme. I couldn't find the element that was causing a horizontal scroll bar until I waded through each level of the divs setting display: none on each until I found that node footer 'Read more' links had a little invisible element that would extend off the right of the screen.

Attached patch fixes the issue (I discovered this while making Parish Theme responsive). All that's needed is one rule to set a width on the invisible element (height is already set).

Status: Needs review » Needs work

The last submitted patch, 4: element_invisible_on-2664214-4.patch, failed testing.

geerlingguy’s picture

Status: Needs work » Needs review

Er... testbot fail?

kryp71c’s picture

Can't test right now, but want to point out that this issue has been fixed in d8 with the same approach (width: 1px). Additionally there appears to be a screenreader issue if you add width: 1px. This can be fixed by adding word-wrap: normal;(see width:1px in visually-hidden class causing problems for screen readers in Firefox).

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.