web-bugs icon indicating copy to clipboard operation
web-bugs copied to clipboard

docs.pushbullet.com - layout is messed up

Open adamopenweb opened this issue 10 years ago • 11 comments

URL: https://docs.pushbullet.com/ Browser / Version: Firefox 52.0 Operating System: Mac OS X 10.11 Problem type: Layout is messed up

Steps to Reproduce

  1. Navigate to: https://docs.pushbullet.com/
  2. Scroll right

Expected Behavior: Text doesn't move behind navigation

Actual Behavior: Text moves behind navigation

Reproduces in Firefox 49 as well, works as expected in Safari / Chrome

Screenshot Description

From webcompat.com with ❤️

adamopenweb avatar Sep 29 '16 15:09 adamopenweb

I can reproduce the same issue on Firefox android. There is a different issue on Ubuntu Firefox 41.0,the content on the far left does not appear at all.

I can't reproduce the issue on Firefox Nightly.

techchic avatar Sep 29 '16 17:09 techchic

Thanks @techchic. Just to add, I can reproduce in IE 11 as well but not Edge.

adamopenweb avatar Sep 30 '16 01:09 adamopenweb

The navbar is at the end of the document.

<div id="navbar" 
        style="height:100%;
                    left:0px;
                    outline:none;
                    overflow-y:scroll;
                    padding:20px;
                    position:fixed;
                    top:0px;
                    width:250px;" 
          tabindex="1">


</div>

It's a position: fixed going out of the flow and then the body is set-up in a way that it has a padding left.

<body style="width: 900px; margin: 0px 0px 0px 250px; padding: 0px 50px 0 50px;">

</body>

The design is working on large screen, wider than 900px + 250px + 50px, around 1630px

The difference in between WebKit/Blink and Gecko is that scrolling on the side keeps the boxes position together.

karlcow avatar Sep 30 '16 02:09 karlcow

Another interesting difference is when we put the cursor on the menu navbar. On WebKit/Blink, there is no scroll, on Gecko it is scrolling.

karlcow avatar Sep 30 '16 05:09 karlcow

They're actually using JS to push the navbar left as the user scrolls:

window.addEventListener("scroll", function(e) {
    navbar.style.left = -document.body.scrollLeft + "px"
})

But there is no real standard for which element's scrollLeft should be changed, and Chrome changes it on the <body> element while Firefox changes it on the <html> element.

It's a trivial fix for PushBullet, and they really should fix it because a standard for this behavior is unlikely to come along anytime soon. They just have to change the above function to something like this:

window.addEventListener("scroll", function(e) {
    var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft || 0;
    navbar.style.left = -scrollLeft + "px"
})

But they really should be reconsidering how they lay the page out entirely, because using JS to do scroll-related effects like this is pretty inefficient, especially on mobile devices.

wisniewskit avatar Nov 02 '16 21:11 wisniewskit

Thanks for the analysis @wisniewskit.

Maybe @christopherhesse or @guzba from @Pushbullet can take a look?

adamopenweb avatar Nov 04 '16 19:11 adamopenweb

I wrote that page. It is not for use on mobile, only desktop. I think maybe that code used to be there for a reason, but it looks like right now it should just use frames instead of javascript for that. If that's too much of a pain, I will probably use wisniewskit's suggestion. Thanks!

christopherhesse avatar Nov 05 '16 00:11 christopherhesse

Actually I don't see any way to have frames without multiple html files? I guess I will just use that javascript fix.

christopherhesse avatar Nov 05 '16 00:11 christopherhesse

@christopherhesse: just be aware that you probably use document.body.scrollLeft in more places than that one, so you may want to make the same fix on multiple lines (or make a simple function for returning the scroll position if you're so inclined).

wisniewskit avatar Nov 05 '16 00:11 wisniewskit

I used that scrollLeft code. Ideally I think it would work like http://jsfiddle.net/qndjW/95/ but I spent 3 minutes trying to get that to work and it didn't work, so maybe some day.

christopherhesse avatar Nov 07 '16 20:11 christopherhesse

I agree that something like the jsfiddle would be better in the long run, but at least we have a fix for the site as-is for now. Thanks, it's appreciated!

wisniewskit avatar Nov 07 '16 20:11 wisniewskit