
Pull to Refresh.js - evo_9
https://www.boxfactura.com/pulltorefresh.js/
======
oftenwrong
I dislike when actions that are typically built into a web browser or OS are
re-implemented by individual sites in javascript. It creates an inconsistent
experience. I don't want a scrolling behaviour that is unique to your site,
even if it's cool. I want all pages to scroll the same way. If I "pull" on
your site, I am trying to scroll up a little bit. That is what a "pull" means
on every other site when viewed in my browser, so that is what I expect to
happen, not a refresh. If I wanted to refresh, I would have used my browser's
built-in refresh button.

~~~
rsoto
(I'm one of the creators of ptr.js)

I have to agree with you on most cases: please don't touch my scroll behavior.
However, this tool was created because on user testing, we found that for our
app, users were having trouble figuring out how to refresh for new information
(which isn't a feed, it's just a list of invoices they have received).

Even when most of web users know that clicking the logo will take them to
home, interestingly this pattern was not translated to mobile. And even when
you have Chrome mobile with a native pull to refresh feature, you have a bunch
more that doesn't have that. So we wanted to create a standard: regardless of
what browser you choose, it will work the same. And we chose pull to refresh
because it's very familiar for our users: we simply say "it's just like
facebook" and they get it.

We released this library because even if all browsers had the same gesture,
the look and feel would be different, and also, because you might not need to
do the default action (reloading the web page), as you might have a SPA that
needs to poll the server, while keeping the current page state.

~~~
oftenwrong
If it makes sense to your users, it makes sense to use it. In any case, I have
no problem with the creation a library, even if I may not like the
functionality it provides.

For me, it would still be an annoyance on the web, as it is something that
applies to a minority of sites I use. In an app, I would be more open to it.

For older people I know, who have not fully internalised common UI
conventions, this sort of thing is confusing. They would only really trigger
this accidentally, and then not understand why it happened. The more dynamic
and/or non-visible a UI element is, the less they understand it. I do not
expect UI designers to accommodate non-tech-literate people in most cases, but
it is interesting to observe.

~~~
chii
on mobile chrome, pull to refresh is already a thing. I turned it off, since i
don't want to accidentally refresh a page i didn't intend to, just because i
scrolled up too fast.

The refresh button is there for a reason. Web devs need to stop making
gestures mean different things in different contexts.

~~~
jexah
I love pull to refresh in Chrome. Considering I usually hold the bottom of my
phone with one hand, if I had to move my hand to open the menu and click
refresh every time, I would use a different browser.

Also the refresh doesn't happen unless you pull at the top of the page (easy
to avoid if you're looking at the scroll bar).

------
promopacket
Love the slot machine mechanic of pulling to refresh [0] [1] [2].

Over the years it's grown to become quite satisfying.

Mmm.. dopamine.

[0] [https://thebrag.com/truth-facebook-pull-refresh-
feature/](https://thebrag.com/truth-facebook-pull-refresh-feature/)

[1] [https://www.vice.com/en_us/article/vv5jkb/the-secret-ways-
so...](https://www.vice.com/en_us/article/vv5jkb/the-secret-ways-social-media-
is-built-for-addiction)

[2] [http://www.businessinsider.com/ex-googler-slams-designers-
fo...](http://www.businessinsider.com/ex-googler-slams-designers-for-making-
apps-addictive-like-slot-machines-2016-5)

~~~
StavrosK
These articles are talking about the reward loop of getting new content every
time you refresh, and you're misrepresenting that to presumably make a point
about pull-to-refresh, which is completely unrelated.

------
greggman
I guess I'm the only one that absolutely loathes pull to refresh. I try to
scroll back to the top to reference something and loose my work whatever
comment I was in the middle of typing, or I lose my place, because i didn't
want to refresh and now the old content is gone. happens several times a week
on iOS chrome >:(

~~~
Nadya
You're not alone - I hate it too. I always think this problem is easily solved
as well. Since touch gestures can already account for "one finger or two". A
two finger vertical gesture should refresh (because horizontal zooms), a one
finger gesture should scroll.

~~~
ovao
Counter-argument: two-finger gestures are unergonomic for single-handed use.
Sometimes that’s an unreasonable trade off; sometimes not.

~~~
Nadya
Counter-Counter-Argument: Refreshing a page is probably as or less common as
needing to zoom a page. Scrolling is _far_ more common than needing to refresh
a page. Breaking one-handed scrolling in order to allow for one-handed
refreshing seems like a poor choice. _Especially_ when my browser already has
a built in refresh button that's easily accessible with one hand. My mobile
browser does not, however, have a built in scroll-bar for one handed scrolling
in the event a site breaks scrolling in favor of refreshing. In fact, since
the scroll gesture is such a standard websites are often designed around _not_
having a vertical scrollbar for mobile because it's pointless... that is,
unless they break scrolling.

I find the concept convenient. I find the execution terrible.

~~~
jexah
You're mentioning something about zooming with two hands. I exclusively use
one hand to browse, and I use double tap drag to zoom. The thing I find most
annoying is moving my hand from the bottom of the screen up a bit to reach the
navbar, whether to swipe to move to a newly opened tab, to close a tab, or to
enter something in the url. Usually though, those actions only take place when
I am "done" on a site, not in the middle of using the site, like refresh.

I have never accidently refreshed a page using Chrome's pull to refresh, and
so I love it. Having said that, if a developer wanted to refresh part of a
page using pull to refresh, they would have to be very careful that it is
implemented well. This library seems to do it pretty well, and does not
conflict with Chrome's pull to refresh.

Anyway, you made the argument that pull to refresh breaks scrolling. I
strongly disagree.

I've seen some pretty shocking broken scrolling, but modals that prevent
scrolling (and have js errors which prevent closing) are usually the cause.
I've never see a "pull to anything" gesture break scrolling what-so-ever.

~~~
Nadya
_> I exclusively use one hand to browse, and I use double tap drag to zoom. _

I also browse exclusively one handed, but not necessarily "one fingered". I
grip my phone between my thumb and other three digits and use my index finger
for any two finger gestures while my thumb is stationary. This allows me to
pinch zoom with one hand. I do this because sites so frequently break one
fingered gestures - not really "by choice" but "as a workaround".

Try doing the double tap zoom on the Reddit home page. You need to be highly
selective of where you double tap, otherwise it treats it like a normal click
and you're taken to a comments section, an article, or an external
image/video. This is either a bug in Android's double tap timeout or with
Reddit breaking the functionality. I can only double tap zoom if I'm very
careful to tap in white space which effectively only exists after a title or
between the "comments" and "..." (more options) items beneath each post.

 _> I've seen some pretty shocking broken scrolling, but modals that prevent
scrolling (and have js errors which prevent closing) are usually the cause.
I've never see a "pull to anything" gesture break scrolling what-so-ever._

I was frequently unable to scroll on Reddit mobile (not the app) because
Reddit thinks I wanted to do a page refresh. It's enough of a problem that I
simply didn't scroll back up anymore when browsing. It must have been a common
enough issue because the gesture had been removed at some point.

------
rsoto
Hey! One of the main devs behind pulltorefresh.js here. Initially we created a
small script to simulate the pull to refresh gesture because in one of our
user experience sessions, the users were having trouble with how to reload the
information shown.

A few months later we decided to open source it and on december 2016 it hit HN
front page, glad to see it again!

I'm here to answers some questions, if you have any.

~~~
mxschumacher
We're using it in prod at Workwell.io - thanks for building & releasing
pulltorefresh :)

~~~
rsoto
I'm glad you found it useful!

------
lcnmrn
There’s a Firefox for Android add-on that’s using this script:
[https://addons.mozilla.org/en-US/android/addon/pull-to-
refre...](https://addons.mozilla.org/en-US/android/addon/pull-to-refresh/)

I guess it just injects the script in every page, but it works nicely, just
like Pull to Refresh in Chrome.

------
0x0
When I try to select text for copy-paste on the demo page, it instead pulls to
refresh and reloads the page, not letting me select any text:
[https://www.boxfactura.com/pulltorefresh.js/demos/basic.html](https://www.boxfactura.com/pulltorefresh.js/demos/basic.html)
(chrome 67 on mac)

~~~
rsoto
In the demos we include touch emulator by hammer.js, that's why it's breaking
it; it's not meant to be used like that.

~~~
0x0
An improvement to your demo would to explain this touch emulator and maybe
have a checkbox toggle it. My first impression was "this is breaking desktop
browsers, I'll never be able to use this".

Just giving an honest first impression :)

------
erickj
The only wrong with this is the octopus logo has 9 arms

~~~
83457
{insert that's not an arm joke here}

~~~
workinthehead
On an octopus, it is!

------
dlhavema
I thought this pattern was losing favor? Since it makes generic
swiping/navigation more difficult to track?

~~~
ashelmire
It might be losing favor amongst people that care about design and
functionality. But it is implemented for another purpose; to create an
addictive habit that keeps you on a social media platform.

------
nrjames
The first thing I tried was pull to refresh on the linked page, but it does
not appear to be implemented there.

~~~
rsoto
If you open that page with a touch-enabled device, you can check the demo on
the main page, since it relies on touch events.

Or as stated before, try opening the demos.

------
ggregoire
For those like me who have no idea what this library is about:
[https://en.wikipedia.org/wiki/Pull-to-
refresh](https://en.wikipedia.org/wiki/Pull-to-refresh)

~~~
usermac
I learned the history and now I know Apple didn't do it first as I once
thought. Nice. Thx.

~~~
mchahn
> now I know Apple didn't do it first

It may not be apple's fault, but many apple fans incorrectly think features
originated at apple, like mobile fingerprint scanning. My daughter thinks
apple invented everything. :-)

------
crooked-v
I think my own preference would be to make a web app that doesn't need to be
manually refreshed at all in normal operation, via some simple polling
heuristics (and careful use of 304s on the server to minimize the total
traffic).

------
andresakle
There is a much better option (weights half as much) for implementing this
same functionality: pull-to-reload @ npmjs.com

------
eoinmurray92
It would be good to have this on npm also

~~~
aapokiiso
Looks like it's already there:
[https://www.npmjs.com/package/pulltorefreshjs](https://www.npmjs.com/package/pulltorefreshjs)

------
darepublic
I really needed this ~2.5 years ago

~~~
rsoto
We initially published it ~1.5 years ago, so close enough, I guess?

~~~
svdgraaf
What do I win then? ;) [https://github.com/svdgraaf/pull-to-
refresh](https://github.com/svdgraaf/pull-to-refresh)

------
homero
I like it

------
amelius
It's 2018. Refresh should be automatic and continuous!

~~~
RandallBrown
I don't agree.

If something is continually refreshing you would lose your context without
doing anything. It would be disorienting if you scrolled down a little,
scrolled back up and found the thing you were looking at was no longer there.

~~~
dlhavema
do a search on thingiverse.com and then scroll down. if you search a big
enough topic every 20 or 30 seconds as your scrolling it jumps up and you lose
your place.. i'm not sure how to avoid this feature, but it is truly annoying

~~~
mchahn
> i'm not sure how to avoid this feature

Talk about a bug being called a feature. This drives me crazy.

