Hacker News new | past | comments | ask | show | jobs | submit login
Elevator.js – A “back to top” button that behaves like a real elevator (tholman.com)
719 points by gitgud on June 24, 2020 | hide | past | favorite | 313 comments



The "back to top" functionality is so useful in web pages. I wish they would make a dedicated button on keyboards that just takes you to the top of the page. Better yet, it can work in other apps too! It could, for example, take you to the beginning of a line when you're writing text.

Edit: Wow, I thought I was going the extra mile to make the joke obvious by saying the key should also take you to the beginning of a text line, but I guess it wasn't obvious enough for the first 3 commentators.


After 20 years of using keyboards, I have, thanks to this comment, discovered the "Home" button.


For Apple 101-key keyboard users, who don’t have a “Home” key: try Cmd+Up (and Cmd+Down.)

Bonus: also try Ctrl+E (and Ctrl+A) in text fields, or on the command-line.

(Both of these carry over to iOS, if you’re curious. I just tested them with the iPad keyboard-folio thing.)


The actual keys are Fn+Left and Fn+End for Home and End (Fn+Up is PageUp, etc). These will also work in Terminal apps or other places that don’t have specific Cmd-Up / Down bindings.


True; but Cmd+Up and Cmd+Down are slightly more universal across the “Apple ecosystem”, given that iOS-specific keyboards don’t have Fn keys, but do support those shortcuts. :)

Interesting aside: the “Globe” key on an iPad keyboard-folio (the one that opens the IME chooser) has some but not all of the properties of an Fn key. Globe+Left and Globe+Right work as PgUp/PgDn, but Globe+Up and Globe+Down do not work as Home/End. (Or maybe they do, but Home/End just aren’t bound in any app I’ve tested? I don’t want to write+deploy an iOS keysym tester just to find this out...)


For the record, Cmd-up/down navigates between prompts in Terminal.app


Lack of a working home/end function is literally the biggest reason I dislike working on a Mac. I don't understand what would be so hard about just having them work like they do on a PC.


Apple sells keyboards with Home/End keys, and they do what you'd expect (e.g. https://www.apple.com/shop/product/MQ052LL/A/magic-keyboard-...). iMacs and Mac Pros come with that type of keyboard.

You can also plug in arbitrary USB keyboards, or pair arbitrary Bluetooth keyboards, to a Mac, and the Home/End keys on those will also do what you'd expect.

Apple just doesn't bother to put Home/End/PgUp/PgDn keys on their laptops — presumably because they find that people don't need them very often; and that, when the keyboard's size is already constrained, people get more value out of fewer, larger keys (while requiring key-chords for some things) vs. more, smaller keys.


> and they do what you'd expect

No, they don't. I expect pressing Home to go to the beginning of the line I am on, and I have to hit Command-Left for that, and Home does nothing of value.


Are Ctrl+e and ctrl+a Emacs conventions?


Yes, emacs navigation keybindings are native in Apple UI.

e.g. ^A ^K to clear an input line


It’s funny. Apple’s UI has taught me how to use emacs instead of the other way around.

I use Ctrl-A and Ctrl-E all the time.


cmd-up/cmd-down go to top/bottom of the document.

cmd-left/cmd-right go to beginning/end of the line.

It seems Word for Mac supports cmd-left/right but not cmd-up/down. Word also supports fn-left (home) and fn-right (end), and fn-opt-left does like ctrl+home on Windows.


This amazes me. Thanks for your honesty, there are probably millions of people who are in the same position. While you're looking down, wouldn't hurt to look at all the different keys and give them a try.


* tries a "Wi-Fi toggle" button, looses internet and is unable to google for help


We laugh, but I had to troubleshoot my dads laptop once upon a time and had to ask him what lights are on on his keyboard. “The airplane light is on”


I had a family member call me in a legitimate panic because her "Gmail got hacked, all of a sudden the whole screen changed and there a bunch of weird code all over the screen!"

Turns out the f12 key was the culprit; took me longer than it should have to realize she was describing the Firefox developer console.


Thanks. And now I have discovered the "End" button!


The first thing I do with any new device is push all the buttons to see what they do.

Push, push-and-hold, and push multiple times quickly.


> wouldn't hurt to look at all the different keys and give them a try.

TIL Enter key toggles comment collapsing.


More generally Enter acts as a left-click on whatever element has focus in the browser. If you press tab, you cycle the focus to the next link/input/button/whatever. Shift+tab cycles through them in reverse order. If a normal hyperlink has focus, you can do things like CMD+Enter (MacOS) or CTRL+Enter (Windows) to open it in a new tab, etc


Since your brain is already in keyboard learning mode, give Shift + Home and Ctrl + Shift + Home a try. It works wonders when selecting text for cutting and pasting. The same combos work with End as well as the arrow keys.


Home and End are the amazing in VSCode for doing bulk line edits in conjunction with multi cursor.


Obligatory XKCD: https://xkcd.com/1053/

Just to pile on with fun new keyboard tricks! Caveat: "linux" here is largely specific to the Desktop environments I've worked with. 'Good terminals' refers to termianls that support emacs keybindings by default, which is the mac os terminal, and most linux bash/zsh terminals at least. I know Cygwin and Conemu respect this under normal usage too.

## Start and end of line:

- Mac: CMD + left, CMD + right

- Linux/PC: Home and End Buttons

- Linux/Mac/Good Terminals: ctrl+a ctrl+e

## "Word-wise" movement:

- Mac: option+left, option+right

- Linux/PC: alt+left, alt+right

- Good Terminals: alt+b, alt+f (mnemonic: 'back' and 'forward')

The 'shift' key can be added to any of the above to select whole words or lines, or parts of lines at a time. Combined with multiple insertion points you've got superpowers.


Other keys that may be non-obvious:

- Insert toggles between shifting characters after the cursor to the right and deleting the character to the right of the cursor, replacing it with the new character you typed, but not replacing a newline character. While eg. Caps Lock is global, Insert mode is local to the text input that currently has focus - tab or mouse over to a new window and you've lost Insert mode, tab back to the one where you previously set it and you're back to Insert mode.

- Delete is like Backspace, but deletes stuff to the right of the cursor.

- Home, as you discovered, moves browsers to the top of the page. When composing text, it moves the cursor to the start of the line (and vice versa with "End"), CTRL+Home moves to the start of the text entry box.

- Page Up and Page Down shift the cursor by screenfulls of text, typically leaving a couple lines at the top and bottom for context. Note to web developers who are unfamiliar with keyboards: Make sure your fixed/sticky header/footer banners don't hide content when using "Page Up" and "Page Down". Also of note, CTRL+Page Up/Down and CTRL+Tab/CTRL+Shift+Tab shift the window or tab focus within an application, for example to go to the next tab in Chrome or the next file in your IDE.

- Print Screen creates a screenshot. Depending on your setup, this may either go to your Pictures folder, or may go to the clipboard (open an image editor eg. Win+R, mspaint, and CTRL+V to paste). It shares a key with SysRq, which can be accessed with Alt+SysRq+(magic letter), and used to recover from various crash conditions - be careful, if you start hitting letters at random, you'll invoke the bad kind of magic that will shut down your computer.

- Scroll lock was used to stop auto-scrolling an input buffer that was running too fast. Largely neutered in modern OSes, it's still useful in the BIOS when all the hardware initialization messages are scrolling by too fast to read. Sometimes it's also used to toggle keyboard backlighting because it had an LED attached and doesn't have a real function anymore, but depending on the manner in which your OS/hardware neuters this key your keyboard backlighting may not work.

- Pause/Break kills a process like CTRL+C, but sometimes has different specific modes of operation in various debuggers. Access the "break" alternate function with CTRL+Pause.

- Super/Windows key opens the Start menu or search tool. On Macs, it's the Command key and used for lots of keyboard shortcuts. Hyper useful for window management, Super+arrow keys move screens to the left or right half of the monitor, maximize, resize, or minimize them, and Shift+Super+arrow moves them between multiple monitors.

- Num lock toggles between entering numbers with the 10-key section of the keyboard and that section's alternate navigation functions, where 7 is home, 1 is end, 9 is page up, 3 is page down, and 4/8/6/2 are left/up/right/down respectively. Not really important if you've got an inverted-T arrow cluster and Super useful on some dumb 17" laptops that cram in a 10-key section but relegate all these normal navigation keys to arcane random Function invocations on tiny distant buttons crammed into the top of the keyboard if they're present at all. Uniquely, Num Lock is typically remembered across reboots.


I had a support call yesterday where the computer was highlighting things and deleting them while the user was going back to change things in a document. I was initially suspecting either a faulty shift key or a double-click setting causing things to be highlighted. When I looked at the user's screen I recognized the block cursor and told him to press Insert.

I haven't seen that or heard of it happening for probably 10-odd years now. Didn't realize it still worked in Windows 10!


It still works in the latest macOS too. I end up accidentally hitting in on my work machine in slack all the time.


> Note to web developers who are unfamiliar with keyboards: Make sure your fixed/sticky header/footer banners don't hide content when using "Page Up" and "Page Down".

Firefox has specific code to detect banners and reduce the Page Down distance. This code fails on new Twitter.


Since we're sharing tips, here's another one: Holding the middle mouse button and dragging the mouse up towards the top of the screen accomplishes basically the same thing as pressing "Home" without requiring you to take your hand off the mouse.


I only use NumLock(button and LED) for test whether kernel is alive or dead.


6 years in university + 10 years of work experience.

Today I know what Home/End keys do, because of a random comment on the internet.


Hacker News attracts a lot of smart readers, so I'm kind of surprised that your comment actually 'fooled' people. It was very obvious sarcasm.


> Hacker News attracts a lot of smart readers

Ahh, I see you're also trying your hand at sarcasm!


Plenty of Mac users out there without a “Home” button.


If I'm not mistaken, Fn + Left Arrow is Home on a Mac. Similar to Fn + up/down is Page Up/Down, and IIRC Fn + Right is End.


It still amazes me that people tolerate that as a substitute.

It's a key combo that requires two hands, for what on a regular keyboard is one finger.

Perhaps Mac people never hold a cup of coffee in their hand while using a computer?


Well, no.

Mac people expect their Butler to carefully hold the coffee cup for them and tilt it so they can take a sip.


My butler chortled


On my old Dell xps 14 laptop, the function button was close to the arrow keys, making it very convenient to use one-handed. I actually preferred it to a separate home button, because, in a text box, I often want to jump to the start/end of a line and then move a word or two inward -- do-able using control+arrows. It was almost as good as vim, although of course I had to take my hand off the home row.


Imagine vim editing across all text fields in an OS. Would be glorious.


macOS has a lot of baked in emacs keybindings that work almost universally in text fields.

Control-A: Move to the beginning of the line or paragraph.

Control-E: Move to the end of a line or paragraph.

Control-F: Move one character forward.

Control-B: Move one character backward.

Control-L: Center the cursor or selection in the visible area.

Control-P: Move up one line.

Control-N: Move down one line.

Control-O: Insert a new line after the insertion point.

Control-T: Swap the character behind the insertion point with the character in front of the insertion point.


"Almost universally" even includes Electron apps, surprisingly!


Home and end are most useful for me when I'm writing or programming, so both of my hands are on the keyboard anyway. I think I actually find these key combos more useful than a dedicated home or end button, as I'd have to move my hands a lot further for those.


> Perhaps Mac people never hold a cup of coffee in their hand while using a computer?

I mean, not while using the keyboard, no. Typing is a two-handed activity.


They don’t. A Starbucks cup is too heavy to hold it for a long period of time.


I'm tired just thinking about this.


right cmd + up arrow and you end up with free cofee-hand


it dorsnt work with cmd


It does for me. I've always used ⌘+up and ⌘+down to go to the top and bottom of the page. After eight years of using Macs, I didn't even know you could use the function key as suggested above.


Personally, I don't get caught up on pressing two buttons on my keyboard at the same time in the circumstance I'm literally doing something else.


Accelerated scrolling makes the home key superfluous. Just scroll "fast".


Yeah, unless the doc is dozens+ pages long. Say, a book on a single page. Then it’s real nice to have a key sequence to get around. Going to the start or end of a long document is an infrequent enough operation I think a two hand sequence is fine.


I use both home and end constantly while coding. Writing text not so much, but it still does happen. Sure, you could do without, but...


On a mac you'd use Control-A and Control-E to navigate to the beginning and end of a line. IIRC Home and End navigate the document, not the line.

https://support.apple.com/en-ca/HT201236


Hm, that would indeed be an alternative. I never tried hooking up a (windows-) keyboard to a mac, but don't see why it shouldn't work. Question is if the software or editors support the key layout.


And, of course, you can always mess with key bindings for a user by creating a file at ~/Library/KeyBindings/DefaultKeyBinding.dict with custom overrides for whatever.


CMD - up-arrow takes you to top of page.


On OS X, this also moves the insertion point, which Home doesn't.


Been a Mac user for 17 years, never knew that. Thank you.


I cannot imagine how painful those years must have been.

The moment I learned my macbook didn’t have a home button I was searching for how to emulate that.


I have Home & End on my keyboard, but they are not very conveniently located. Mapping <Super>-A and <Super>-E to Home and End is much more ergonomic (or you can use other modifier like <Ctrl> or <Alt>). Not sure though which keys should be mapped to PageUp/PageDown. Those are not terribly useful keys anyway if you use touchpad or Space.


Also, use Up Arrow to go to the beginning of the line and Down Arrow to go to the end of the line on single line text boxes (I use it often on browser address bars).


Also, system-wide in basically any text field, cmd+left/right does the same, and alt+left/right moves the cursor to the previous/next word.


My work Apple keyboard has a home button. It's right there between Function and Page Up. https://www.apple.com/shop/product/MQ052LL/A/magic-keyboard-...

My home Apple keyboard has the Home button between Help and Page Up. Though, I will admit that keyboard is 2003ish. But I keep using it because it still has good action.


Is that one of the A1048 [1] "crumb tray" keyboards with the clear rim around the edge? I recently switched to one of those from an original iMac keyboard (finally got fed up with not having a forward delete key) and the key edges and the action both feel crisper. Could just be that I've been using the other one for a decade or so though.

[1]:https://en.wikipedia.org/wiki/Apple_Keyboard#Apple_Keyboard_...


Almost. It's the Apple Pro Keyboard (M7803)

https://en.wikipedia.org/wiki/File:Apple_Pro_Keyboard_black....

I have to get a USB⇄USB-C dongle so I can use it on my Windows machine.


Ooh, I need to get my hands on one of those. The best of both worlds!


Also, CMD + Arrow Up scrolls to top.


I have an Apple keyboard with a home key and I never use it.


Fn+LeftArrow. RightArrow for End.


And phone users


When people don't get humor, they're still picking up on the incongruity in it, and this bothers them.


> Hacker News attracts a lot of smart readers

Here's where I disagree


i have worked with way to many people that don't know what the navigation keys do, don't understand most of the control keys, and the only function key they know is F5.

Way too many people who have never used an actual console terminal


Only function keys I know off-hand are F2 and F12. Mostly because I prefer modal setups and only ever need those two during boot. Although without checking I have a suspicion that F5 refreshes a browser window. Am I right??


its not a surprise at all


Hacker News attracts a lot of readers who THINK they are smart or whatever that means.


Boom egos shaken


Use the keyboard? Do I look like some sort of hacker? I just mastered double clicking so I’ll just keep clicking thank you very much.


Vimum plugin

gg - go to top

G - go to bottom

You can also go anywhere on page (litterary) with single key (homework).

Much better then home/end as you usually need to hunt for those keys, or even use them with Fn modifier.


The problem with plugins is that they give full control over your browsing to whoever controls the plugin.

I sometimes install plugins myself if the code is open source and it is small enough for me to vet it.

I would love vimium, but the code is way too big to vet it myself.

I wish there was some party that is trustworthy, vets codebases like these and publish hashes of trusted versions.

An alternative would be more modular codebases. So instead of publishing a giant box of code with all kinds of vim-like behavior, publish lots of small ones. Like the code to make gg work.


I think you are being overly paranoid.

If you want to fight for security on that level, your computer life must be miserable. You are also missing out a lot of great tools and are way less effective then folks that use them (and thus less competitive).

I am all up for great security in OS, emails, browsers, messangers etc, but it has to stop somewhere. Also, this kind of stuff like vimium is so widely used that somebody would probably notice if something funky is going on (everything leaves some traces, you dont really need to look at the code to notice it most of the time).

Your proposed way to solve this issue is way worse - now, instead of having one monolitic but still simple and well rounded app you have thousands of little scripts that combined are also hessle to review, belong to way more humans with different agendas (instead of single or couple) and would be horror to initialize (really sounds like nodejs ecosystem).

Just get the damn thing and relax a bit. Anything malicious that could be done by some developer is already done by big evil corps anyway (and more) and you cant really escape those.


I share your perspective, but it's not a good perspective to encourage, imho.


I believe it is. You can say the same thing about anything else - do you inspect any TV or telephone you buy for hidden recording devices? Do you inspect any hotel/airbnb room ? Do you do that with supplements, cooking aparatures, plant checmials, mattress material, car breaks etc.. No you don't. You believe its good. Multiple times it did happen they were not good and stuff were spying, poisoning, leaking, killing etc. Yet nobody decides to not buy stuff in order to be 100% protected like there is such thing, because it is miserable life.

Life is risky by default. You calculate your ods.


Great argument. The Pure Food and Drug Act of 1906 and it's fallout probably have some good lessons to learn on both sides of this question.


Honestly I'd rather have one big unified collection if I was going to review.


Came here to say this. Vimium is excellent! I've been using it for the last number of years and when I switch to a new computer without it, I still fire off the `gg` and wonder why the browser isn't picking it up. It's essential to me at this point.


I was quite amazed when I found out that not all developer colleagues of mine knew the "Home" button.


My laptop doesn't have this button (you have to use a weird combination of keys). The days of everyone using a full keyboard are long gone...


what laptop?


Dell latitude.


The button is available on the Dell longitude I think


I just found out that Home button ( without Ctrl ) works in browsers. I knew the Ctrl + Home combination ( which also works in other programs ).


On tangent, it's strange that our keyboards mostly stayed the same while the screens got around x20 better.

I often need to make bigger and smaller jumps with keyboard. In Sublime I use a plug-in that can jump 10 lines up and down but I also need that functionality across the rest of OS. For navigating menus, scrolling through content, moving around spreadsheet. Page up/down is too large jump with the amount of content that can fit modern screens.


Yeah, 10 line jumps are awesome when coding. In emacs I bind this behaviour to the ctrl-up and ctrl-down like so:

  (global-set-key [C-down] '(lambda () (interactive) (next-line 10) ))
  (global-set-key [C-up] '(lambda () (interactive) (previous-line 10) ))


That's exactly it. Before that I tried AceJump, but it demanded attention while this method becomes like a second nature.

I probably need a scriptable keyboard to make it work across all programs. Some keyboards support Lua, but I think it's only for LED patterns which is pretty retarded.


The first half of your comment could have been sarcasm. But the second part, with the exclamation point, definitely sold it.

Sarcasm is definitely not impossible to detect in writing. You just to have to trust people and give them the benefit of the doubt.


Over the years I've tried to teach people about the Home key but to no avail. Similarly I've tried to teach people about using middle-click to open a link in a new tab, or some basic readline functionality like Ctrl-a, Ctrl-e for beginning end of line. But I've not seen a single other person use these features. Strange.

Thinking about it some more, I was being driven in a friend's BMW one day and there was some bad smell coming from outside so I asked if I should press the air recirculation button. It turns out he'd had that car for more than five years and had never pressed that button. In fact, he'd never pressed, nor seemingly even wondered about, most of the buttons in the car. Strange.


Okay, but every time I try to hit the Home key with my mouse, I end up hitting the Insert and PageUp keys too, since they're so close together, so it doesn't solve the same problem that a back-to-top button does.


I know that it a dedicated button for keyboards, but on phone keyboards this is still a missing functionality which I really miss!


At least on iPhone, tapping the status bar on the top of the screen usually scrolls to the top for all (well developed) applications that have a vertical scrolling view, but just web pages.


Tap the status bar on any iPhone?


Touching the top-most part of the newer iPhones (with the notch) scrolls you back up to the top page.


I predicted every comment before I read it down to the one about the right cmd button I too have used the Mac while eating a taco.


Seriously though, the Opera web browser has this functionality built in, but it's a "toggle" back to top, by just clicking on the tab title.

It's very useful on web sites like HN, when you don't want to lose where you are in the thread, yet need to go back to the top to have a second look at the topic for instance.


I definitely got your joke and had a snicker. I wonder if part of the reason the obviousness is missing some people is that many of us use Macs, and the "beginning of a line" behavior is not the default behavior in most native Mac apps.


I fell for it because although I’ve used a computer constantly for over 20 years I don’t think I’ve ever touched that home button. At least not deliberately.

I never use escape or any function keys either.

I still can’t figure out how to get in and out of insert mode in sublime text. When it happens I just quit and restart.

I’m starting to wonder why I tolerate this level of ignorance in myself.

I mean, I use key commands constantly. That’s what is odd about all this.


> I still can’t figure out how to get in and out of insert mode in sublime text. When it happens I just quit and restart.

Not sure if joking, but you literally press the button labelled "Insert".


I'll be honest, even though I use the home and end keys on a daily basis while programming, I don't think it's ever occurred to me that I could use them to move around a webpage. I feel both dumb and enlightened!


Cant tell if this is sarcasm or not, but "Home" key does this...


The Home key is fine if you're on a PC. On a Mac the only time you'll see one is on some extended external keyboards. It's rare, if nonexistent on Mac laptops.

So you need to press Cmd+Up. Yes, it's two keys instead of one but I would argue it's actually quicker since they are both usually located on the bottom row, meaning there is less distance for your hand to travel.


Cmd + Up is similar in behavior to the macOS Home key behavior, but slightly different. On laptops (or any desktop keyboard with a Fn key), Home is Fn + Up. The differences are:

- Home (and Fn + Up) don't move your caret if you're in an editing context, except...

- Some apps have different behavior for Home than go-to-top. Typically these exceptions use the Windows behavior of go-to-start-of-line (obviously this does move your cursor).


I’m normally a macOS guy but I’m currently using windows full time to give WSL a proper chance. The thing I miss most is CMD+Arrow to go to the start/end of something. I think it’s a beautiful system, alt+arrow to jump a word, cmd+arrow to jump to the start/end. The home/end keys are always so hard to find especially when they could be anywhere depending on your keyboard


Alt+Arrow on OSX is Ctrl+Arrow on Windows.

I just switched to OS X recently and I am definitely having the reverse trouble getting used to the Cmd/Alt+Arrow I almost never have problem finding Home/End on any keyboards (been using Windows/Linux for 15+ years). Nowadays for laptop it's almost always fn+Arrow for Home/End.


Once you get into mechanical keyboards, there are many custom layouts for anything outside the typewriter keys ;)


How many percentage are there? I am not from English speaking countries, and I have never met anyone using non-standard layout before. So, like, do I need to care if I am not targeting software developer?


I'm not a Mac user so I may be missing something but can't you do that with Ctrl+left/right?


Ctrl+left/right is equivalent to alt+left/right on mac, which jumps to the start/end of the word rather than the start/end of the line


> On a Mac the only time you'll see one is on some extended external keyboards. It's rare, if nonexistent on Mac laptops.

What do you mean some keyboards? Any PC keyboard you connect to the mac will support home, end, page up, etc. (Unlike buttons 4 and up on mice)


The mouse button thing drove me mad at first, but https://sensible-side-buttons.archagon.net/ can fix it and give you the expected functionality.


Or shift+space if you want to take steps until the top (maybe you just want to navigate up faster, and not to the top)


Wow, thanks!

I use space all the time to scroll down on a web page, didn't know you could reverse direction, awesome :)


You can create a bookmarklet with the code javascript:window.scrollTo(0,0); that will scroll back to the top, but it won't have an "elevator" effect.


Now if only the End key could go back to being usable...


Sarcasm is nearly impossible to detect in writing.

A tip: If it seems the whole world is a problem, it's probably not the world that is the problem.


Yeah, I wish somebody invented a sarcasm punctuation mark /s



How ironic ؟


I always felt that this diluted the sarcasm and was a bit like explaining a joke


Well it's not like the entire point of sarcasm is to mean something other than what you say.


Leonard: Hey, Penny. How's work?

Penny: Great! I hope I'm a waitress at the Cheesecake Factory for my whole life!

Sheldon: Was that sarcasm?

Penny: No.

Sheldon: Was that sarcasm?

Penny: Yes.


> Sarcasm is nearly impossible to detect in writing.

SaRcASm iS NeARlY ImpOsSibLe To dEtecT iN WrITiNg.


Hahaha you must be american, right? USA is not the whole world hihihi


It's very easy to detect if you knew the button existed.


Guess I’m the one who didn’t get the joke as well.


Ha. Now imagine one which did the opposite? You could even call them Home and End, or use arrow icons.


On Mac: Fn + left

On iOS: double-tap the top bar

On Windows: use the home key

On Android: swipe your thumb a dozen times really quickly


There is Vim/gVim for going to the beginning of the line.


Many Apple keyboards have no "home" button.


Fn+Left Arrow emulates HOME on most Mac keebs lacking that key. Hope it works on your too :)


I don't know! I run Windows 10, BTW.


it's useful in mobile though!


If I understand correctly you are talking about a button that already exists on most keebs and is called HOME.


hahaha nice thread


This is pretty funny, but God do I hate back to the top buttons.

I'm reading a story on a page with a back to the top button. I get distracted in real life and change the grip on my phone. I look back at my phone to continue reading and I'm at the top of the page. Now I have to find where I was again.

I've probably lost more time from accidentally hitting the back to the top button than the button has saved me time. This has made me paranoid about those buttons and I definitely prefer sites not to have them. Sometimes I switch to desktop mode on my phone just so I don't have that button on the screen.


Me too! My phone already has a built-in “back to top” button. I don’t need your ugly 0.5 opacity CSS circle occluding my view of the content.

I’m not sure I’ve ever clicked (or tapped) one of those buttons. The same complaint applies to share bars, and honestly, sticky headers as well. I really prefer to just read the content and let my browser handle the chrome.


I really hate them on iOS, because the system comes with back-to-top functionality so all these buttons are doing are looking ugly and covering part of the page. And don’t even get me started on when AMP breaks scrolling…


I just want to take a moment to give a shoutout to the Tweetbot devs, which expanded on iOS’ back-to-top functionality:

Tapping the top of the page again takes you back to your scroll position! Incredibly useful for recovering from accidental taps, and I kind of wish iOS would copy it, since it happens more often than I’d like.


Interesting!

I always thought that re-scrollback was just a feature of iOS. I use it all the time in Apollo. But it doesn't seem to work in the Reminders app, nor the Notes app. Way to go Tweetbot and Apollo devs!


The Apollo reddit app also does this! Really great feature when I want to go back up to look at the content again and then go back to the comment I was reading.


For anyone else who was wondering, you can tap the top of the address bar on iOS Safari. I think it has to be expanded first. I didn’t know that and hope it helps.


It works just about anywhere, actually. Just tap the time (or tap the earpiece, on a notched phone) to scroll to the top. Works in Safari, Chrome, Messages, Reddit, Tumblr, Twitter... the list of exceptions is short.


(This works through the system, by the way; it’s not just limited to Safari.)


Except on AMP pages.

Fuck AMP.


This is interesting, I've often found the buttons to be useful at times on mobile, so was wondering where all the hate came from, and turns out it was because iOS already has the feature built-in (I use Android, which doesn't really have an equivalent afaik).

Though to play devil's advocate, I'm willing to bet 80%+ of iOS users have no idea the feature even exists, so removing it just because it's available as a system feature doesn't sound like a particularly compelling argument to me.

I think having some kind of sticky navigation instead of scroll to top makes for a much more compelling UX though, since it accomplishes the same goal without the downsides of hitting it by accident causing an irreversible loss of context.


They really should only be at the bottom of an article, less annoying then in my opinion.


I think this is just problem in general with touch devices. Also the way modern apps are designed, where almost everything is button, does not help. See mobile twitter, for example, close to 100% of the screen is link of button that does something.


"back to top" is just such an epitome of how out of touch some modern design is.

We had buttons on our keyboards that did this for half a century now. As for phones it should be up to the web-browser to implement it, nobody wants to use your idea of how scrolling should work. My machine already knows how I want to browse my content, don't pretend you know better.


But if you make a really big button (or a button that appears out of nowhere on mouseover on PCs) that people frequently hit by accident, your "engagement" metric will improve, showing that the feature is valuable!


It's funny because it's (probably) true.

...AARGH! No, scratch that. It's actually infuriating. :)


The worst offender of this right now is email programs. You go to click an entry in your email list and then suddenly you've archived it with a little icon that wasn't previously there.


> out of touch

This is ironic. The vast majority of users don't know about most of these functions. They just use their mouse. Even for basic things like:

- navigating & selecting text (words, lines etc.)

- switching between windows

- opening search (like spotlight, if they use it at all...)

- opening & closing windows/tabs, saving files etc.

The list goes on. UI design is not about teaching you how to use a computer. And you certainly cannot expect users to already know.

That said. I think fixed position "back to top" buttons are terrible as well and I would put fixed position header-menus in the same category. They just add clutter and worsen the UX, even for those who almost exclusively use the mouse (as you can simply drag the scroll-bar).


True. Whenever I sit and watch people use the computer (just watch when they are giving a presentation/screen sharing), I often cringe.

Many don't use the scroll on their mouse/trackpad - they literally look for the scrollbar, click and drag to scroll.

Many are blissfully unaware that the keys Page Up and Page Down move the page up and down or that Home and End move the whole page to the beginning and the end.

BUT, they do know about the Back button on the browser so they end up resubmitting forms/double posting, etc. lol


Sure but should all these be part of browsers UX not the website itself?

Maybe we should be pushing browsers to have better UX on-boarding and teaching people that home button will scroll you up to the top of the page etc.


Does Android not have some native scroll-to-top gesture/button? On iOS you just tap the status bar and it's uncommon for it not to work where you'd expect it to.


No, I feel like a caveman saying this, but if you want to go to the top of the page, you have to flick your finger down really fast, or reload the page.


I like Android's scrollable scroll bar (I don't know precise name) that supports scroll to anywhere but nowadays very few app uses it.


As far as I am aware it does not. That sounds like a useful shortcut.


I think its actually a result of people using only (or at least, most of the time) the mouse to browse the internet. If you just click from one link to another, pressing "home" is actually quite a far reach. There are people around that still think you have to drag the scrollbar. Sure, "home" is way faster, but a (well implemented) choice helps some and does not hurt.


A floating back to top button just means they don't want you to waste time reading the content. You should click around and view some more ads instead.

I mean, that's the only possible conclusion I can come up with, since they give the button such prominence. It's the same with newsletter popups. You shove that in my face, obscuring all other content, it means your site is dedicated to harvesting email addresses, and you want to spam me senseless.


Or maybe it shows how out of touch the old design was (the fact that it had been there for half a century and even folks on HN had never seen it...).


It woke up my wife, as I tried it on my phone when the stupid elevator music played it out loud :/

In all seriousness, I hope this will not become another 250kb JS framework we use in our projects..


First if all, fuck webpages that play sound unexpectedly. Secondly, what percentage of elevators even play music these days?


Secondly, what percentage of elevators even play music these days?

Pretty much every elevator I've been in for the last ten years. I note it mentally because spirit of the music is always at odds with the messages on the display screens.

I think the only elevators where I haven't heard music recently are in residential buildings.


Maybe it's regional, as I've never heard music in an elevator before.


Same. Weird. I never imagined something so seemingly consistent as elevators having regional dialects.


Where do you live / what type of buildings are these?


huh... no shit. I think I've encountered maybe 2 or 3 elevators that play music in my life, and I'm a middle-aged guy living and working in a major metropolitan area where most non-residential, and many residential buildings have elevators.


Same here, it's 6.40am here and I am about to start my 2h sprint before my kid wakes up. I feel I deserve for browsing HN instead of being productive :D


It's 1.77kb of JS. But in any case, I don't think you need to worry about many people using it.


The music gave me a small heart attack as well since I was just watching a movie earlier and had my volume turned way up.

Had a good laugh about it afterwards haha...


I had to stumble upon your comment to realize that thing made noise. I was wondering how a "scroll to top" function was at the top of HN.


Thanks I didn't notice there was music.


You don't keep your volume muted? That's a little silly


You judge how other people use their computers without knowing the first thing about their circumstances? That's a little silly


Nice one. Something important missing in this framework is a logic to check the number of people in the elevator. You should use webRTC to count the number of users using the elevator. And if it is more than 8 it should sound alarm!


So the modified algorithm will be as follows. When the user clicks elevator, it first sends a distributed query to all browsers and each browser replies with 0, if elevator is not being used, or 1 when it is used. After the polling is done, it sums all responses. If sum_resp_elev<8:move() else Ring_alarm()


Nope. When you're at the bottom of the page, you should first have to call the elevator. Then it should stop at all those levels at which other people have also called it before coming to your position. Then you get a chance to be kicked out for being overweight.


How many other people are quitting web development after seeing this? I think the work is done, there isn't anything else needed here.


What's the opposite of development?

I think we need web un-development to get us out of this javascript tar pit.


Clearly it would be velopment.


Making actual stuff instead of a “content framework”.


A lot of people already mentioned here the Home button. Anecdote: for years we kept getting users asking for a back to top button and we always told them to just use the Home button and they thought it was the most amazing thing ever. Most of our users are on Windows.

Anyway, we did end up having to put a Back to top button. It was clear that users just don’t get it. Most people really don’t know what the Home button does.

That, and you should never use the Mailto: link without writing the email as the text itself. Thanks to webmail, most users do not have their browsers configured to open mailto: so they complain that contact email links on their pages don’t work. Sigh....


I don't know why this is "thanks to webmail". At least firefox can handle this perfectly fine.

That being said seeing the email is nice anyways in case you need to share it with someone or type it into your phone.


To clarify, all browsers CAN handle the mailto link as long as the user configures it to open the correct email client. That’s key because there’s many oblivious users who don’t even know about this setting (we know from the number of support requests we get from users angry that the contact link they created on their websites “don’t work”!). :)

Because of the prevalence of webmail like gmail (most of our users are on gmail) there’s many users who aren’t aware that it needs to be configured to open the said webmail page, so the mailto links does nothing. A “Contact me” or “contact support” mailto link won’t open anything, or it will open the default mail client like Mac Mail on Mac....On Windows in the past it would open outlook express lol. :)


I still don't see how webmail has anything to do with it. In fact opening Gmail prompts me to make it my default mail handler.

Users can fail to configure mailto links to point at their preferred email client irrespective of it being web-based or native. (Unless it is the default for the platform I guess)


> Users can fail to configure mailto links to point at their preferred email client irrespective of it being web-based or native. (Unless it is the default for the platform I guess)

That's more the issue. It's just misconfiguration and users who are oblivious to that setting. In the past, I don't believe that Gmail prompts you to make it your default handler, and from the number of support requests we received due to this issue, it's clear that a good number of users do not have their mailto handlers configured.

Cheers!


Also, many people have a work email account and a personal email account, and a mailto link doesn't give them the option to choose which account to send from - there's no reason not to write out email addresses as the text itself.


Many we don't use a mail client, so the mailto does not work because it's not configured :)


I was expecting the button to light up and having to wait before being taken to the top. Maybe an improvement for version 2.0!


And then you have to select the floor before it's going up, Ha!

Joke aside, maybe add a feature to allow user to pause/suspend the "Lifting"? This will give user a chance to "Hey! oh wait" when they "Passed the desired floor by mistake".


Close the doors, sometimes hangs, support button. Stairs and other passengers.


Warning - There's elevator music as well!

Wish this was mentioned on the page, it was a bit embarrassing when it started playing in the middle of our daily standup!


I respect that it put you in a bind, but a warning would have totally ruined the joke for me.


Maybe you should have been standing up rather than idly surfing :D

I always mute myself when I'm not speaking


I have never needed a "back to top" button in a web browser. However on almost all sites that offer one I've been missing a "jump to where I just was before I misclicked" button.

Those endless, highly volatile feeds that often can't even keep the ordering of content between page refreshes are annoying.


Back to the top buttons are a symptom of the system-within-a-system feature of Web. The Web page isn't a document: it's a system, a virtual machine. Just like running another OS in VirtualBox implies bad interoperability and a lot of duplicated effort with the host OS, so too does running web pages. In a quest to be everything, Web became a bogged down, developer-time devouring beast. It can do almost anything, but you don't want to do anything on it.


It means universal, think smalltalk. Has ups and downs - not much integration with a host comes with independence from a host. IE was created because Microsoft feared web would make OS inconsiderable. There was bold claim even before Netscape's Constellation [1]. So everything goes like it was predicted years ago.

[1] https://people.apache.org/~jim/NewArchitect/webrevu/1997/02_...


Is there any way to tell Chrome not to make sound unless I explicitly want it? Maybe I have less tolerance than most people, but I just can't stand it when my computer makes unexpected noise.


Your tolerance seems right to me. I've got a german chrome so menu names might not be correct. Options->Data protection and security

scroll all the way down to "content"->Additional content settings->Sound

Here you can do stuff.

edit: readability


There is a setting or an extension I use to mute all sites by default. You can then whitelist domains one by one. It’s a lifesaver.


Right click mute tab (i think it might be experimental)


Haha, it used not to be, but then Google crippled the feature. Firefox is looking better by the day.


Google changed it for "Mute website" when right-clicking a tab and it's not experimental.

It's better than "Mute tab" because it's persistant over multiple sessions.


I have issues with Firefox as well.

1 problem in a browser is most definitely not enough to discourage it.

- I use both btw.


For those that didn't get it, turn your sound on.


I didn’t realize I had my volume all the way up. Scared the crap out of me.


Very good, but it should also be non-functioning 60% of the time due to repairs and/or inspections.


I'm trying to think of times when I've seen a non-functional elevator and can't think of one.


Come live in my building... we're usually operating at half-capacity. Presently we're down to 1/4 elevators for a 32-story residential building. It's a little on the frustrating side.

Our elevators break down quarterly, and for some reason the wait for Otis-approved parts is weeks to months at a time.


Try living in an eight story crapartment and you'll understand.


If your elevator is closed 60% of the time for repairs please don’t use it.


I'd rather ride an elevator that is closed 60% of the time for repairs than an elevator that is closed 0% of the time for repairs.


This explains a lot about your username!


I think other than being kitchy, the part I love the most is NO FRAMEWORK: plain js. No pre/mid/post/art-deco processor that turns 4 hours of work into 40 hours.


I've been developing some games and frontend on my free time for fun. I've been using typescript and Pixi.js but other than that nothing else. As a backend engineer, I've always thought about learning a frontend framework but I've never actually had a strong need of it.

So question if you're a frontend engineer: Should I? I never felt the need of a framework despite I render quite a bit of dom elements. Do I have a need that I just don't know right now?


If you want to get a job as a frontend engineer, you should learn React because it's a tick-box on a lot of job postings these days.

If you just want to make personal projects, it depends a lot on what kinds of projects you want to make. React won't really help you with the sort of 2D-game-type programming you're using Pixi.js for. On the other hand, if you think the Reddit redesign is really good and you want to make a website that works exactly like that, the React community is a good place to start.

But one of the main benefits of using React that I've heard about is that it forces all the members of a development team to organize (certain parts of) their code the same way. This isn't really an issue on personal projects. Personally, I spent about a year working with React for a job, but I continue to write vanilla JavaScript on my own time.

(You can learn other frameworks than React, but React is a good starting point because it's the most popular one. Then you can learn about Framework X by reading "how is Framework X different from React" articles online.)


> if you think the Reddit redesign is really good

Conversely, if I think the reddit redesign is horrible, I guess I should stay well away? ;)


Thanks for your detailed answer. I got my answer right where you said 'if you think the reddit redesign is really good'.

Which it's not.


If you have a multiple team-members and you need to get everyone using a common approach, frameworks can be useful. If you need to do small unit's of work and need to leverage boilerplate functions, frameworks can be useful.

The issue I see today is many of these frameworks started as ways to build efficiency; they have degraded into disciplines that require exorbitant investment without corresponding business value.


I never felt like I needed one but recently I’ve found that when writing larger apps, React is really worth it


Yep, you're right. We immediately have to make a version that is made with at least two frameworks at once here!!


I thought this was going to scroll up to each heading and stop scrolling if you touched the screen. Now that would have been useful. Otherwise I tend to hate scroll to top buttons. I'm always accidentally touching them and usually they won't stop till you're at the top. It's terrible.


I was hoping for a Koyaanisqatsi-esque visual interlude as the page scrolled back up, but this is still satisfying.


In a few years mankind will "discover" the scroll bar and the inventor will be hailed a hero.


and few years later they will re-discover the Home keyboard key.


I could really go for a browser plugin that plays elevator music when you drag the scroll bars up and down.


I thought “behaves like a real elevator” meant that it would make stops along the way. Oh well ¯\_(ツ)_/¯


Nobody went through source and noticed the Dalek hiding in the comments? Made my day.


I did.


This is so useful and silly I love it. Would have been perfect for my late 90s geocities site, had the functionality existed back then.


Scrolling back to top like an animal? No thanks, I just refresh the page instead as a civilized person would do.


Which only works if haven’t hit any in-page anchor links ;) otherwise, you’d snap right back to a particular section after a refresh.


This gave me a good laugh. Great project.


Is there any way to make this work as a bookmarklet that I could just click to use on any site?

=== On a side note: There is an alternative to this that does far more. Vimium is available at:https://chrome.google.com/webstore/detail/vimium/dbepggeogba... It's based on Vim commands so It helps if you have some familiarity with that. It allows you to perform all basic features you would use in a web browser, like scrolling, refresh, forward/back etc; using only keystrokes.


I don't like "back to top" buttons because they take visible space and could be anywhere (if any) depending on the website. I don't like Cmd+Up keystrokes either on my mac.

Instead, it would be great to have something:

- That works on any website

- That can scroll to top, to bottom, and back to the place where you've scrolled from.

- Doesn't alter the websites appearance.

So I've created a tiny Chrome extension that solves all of this: https://github.com/sv3k/topscroll

After some time, you get used to it on reflexes level.


vimium does that & a lot more.


Had my volume turned up, Christ this nearly gave me a heart attack.


There is a bug when it's finished and you instantly scroll down and press the button again that it then won't play the arrive sound if it arrives.


We need a “ding!” sound effect when you get to the top!


It does?


Huh, that didn’t play on my iPhone. The music just stops.


That was charming. Always a fan of little doodles like this that are completely unnecessary but you're glad they exist.


Made me laugh! Would be way more awesome if gates closed above the page like an old school elevator before it went back up


Clever, really is a better experience. I’d love to see this used more. I haven’t seen anything like this in a long-time.


Can we just go back to buttons that _jump_ straight to the top instead of scrolling? Please?

What problem is this even trying to solve?


That's what I did on my blog [1]. I tried different methods and realized that it should be a simple link that jumps you straight to the top and nothing fancy. The only JavaScript used it to determine when to display the link.

[1] https://www.primative.net/blog/how-to-get-rid-of-the-flash-o...


I expected a few stops along the way


Don't use it in case of a fire


I prefer rockets to elevators: https://factorio.com/blog/post/fff-353


What, no closing doors? ("The little lights, they’re not twinkling.")


Just in case author reads this...

Movement is janky on latest Firefox on Win10, 4K screen. I don't know if that matters much, but I'll leave it here just in case you actually wanted feedback.


"Elevator" and "JS" reminds me of Elevator Saga. https://play.elevatorsaga.com/


I was about to write the same thing. The perfect puzzle for a programmer.


Hahaha. Nice one. As soon as the muzak came on, I had to chuckle. :)


I'm on mobile, does this framework at least disable the home button? I would consider that a must-have for elevator frameworks.


Feedback: The back to to top button gets obscured by the navigation keys on iPhone. Also, the page would benefit from a more fitting viewport on small devices.


For those that don't know: on iPhone, touching the top (like near the front facing camera) works like a jump to top button in many contexts.


A real elevator would have stopped at each level.


Wow that button is like a portal straight to hell, well done I guess. Most soul destroying thing I have yet encountered.


Just wondering, is it possible to add a global 'back to top' button on mobile? Shall the browser implement it?


This is so pointless I absolutely love it


Implement this on infinite scrolling sites with sounds of crying and screaming, then we're talkin'.


I expected it to stop at each floor. :(


Not enough procrastination already?


I love stupid fun stuff like this.


And here I was thinking that websites didn’t play sound without a nag prompt on iOS...


Ugh, I thought I had tabs muted by default in my browser... Clearly I was mistaken. Turns out I need an extension for it. But now I have ugly mute symbols on every single tab which isn't "default" at all. What I want is sound symbols on tabs that I have expressly un-muted.


With Chromium based browsers you should be able to set every website to be muted at first. You'll only see a mute symbol on the tab when the tab tries to play sound.

If there is no sound at all, there shouldn't be an icon.


That does sound like what I want. This is the first time I've heard of a compelling reason to use Chromium over Firefox. Hope I can find a decent solution for Firefox.


This both absurd....and seems more natural than most browser experiences...


That's the point of this library ?

It scroll up slowing, harmful to my eyes. I'd rather "teleport to the top" or quickly scroll to top on my own than watching the animation…

And I cannot cancel the scrolling in the middle of process if I accidentally click it.


He did it for fun. From the Github:

> Finally, a "back to top" button that behaves like a real elevator, by adding elevator music to quietly soothe the awkwardness that can ensue when being smoothly scrolled to the top of the screen. This is very serious stuff, here's a demo!


I missed the music! This is awesome


Gosh, I could press that button all day.


wow. When I have the time I'll have to add a janky gate that closes but you can still see the text passing by.

Can also be a bit bumpy when it passes "floors".


Cute, but the movement actually made me feel nauseous.


If this were a chrome extension, I'd be down.


That's fun. Take that infinite scrolling pages!


I love the Dalek Easter Egg in the js source code


Growing up in a post-communist country I have very different expectations regarding how an elevator operates, namely that instead of a smooth start/stop it should have two speeds - the slower used for stopping exclusively.


I have just found a website for author: https://www.usa.gov/find-a-job


The demo page needs a lot more floors.


Could have done without the music in a coffee shop right now. :)

I normally always have my laptop on mute, because I'm paranoid about bothering people.


I think the music was the punchline.


This is fun, but on the serious note, we should not be modifying the scroll behaviour of the browser in any way. It is not as usable.


It's not a bad argument. Similarly, I think everyday life would also be confusing if the laws of physics changed depending on what restaurant you walked into.


Now we need a go to bottom button.


Playing music is a terrible idea.


That’s the punchline.


I love it!


sound alert really needed there.

I was shocked, but that was a fun one, I laughed too.


Thanks, you made my day.


with fucking music, I wasn't prepared for that


Well, I just clicked the link to see if this also includes the Girl from Ipanema…


yep .. almost blew my ears out :/


This is entertaining. HN continues to pleasantly surprise me.


nice tune though while going to top !!


nice tune though while going to top


scared the beejesus out of me haha


double tap the status bar on iOS


Cute gag, but why is this top story? Not that there's anything wrong with /r/ProgrammerHumor but I go to HN for different reasons.


Because a few hundred people upvoted it over the last few hours. That I know for sure, though I can't speak to their reasons for visiting HN in the first place.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: