4 ms·
Nice! It breaks the back button however...
by cmer 16y ago
Nice! It breaks the back button however...
- catch23 16y agoSeems like the navigation history was intentional.
- nickbarnwell 16y agoAu contraire, the back button behaves exactly as it should. It's not how users would expect it to function, but it does obey the stack.
- cryptoz 16y agoWhat you just said makes no sense. If a button doesn't follow what the users expect to happen then the button is broken!
- aditya42 16y agoNot true. A back button is meant to "go back to previous state". When you click a link, then back, you will go back to the previous page or position on the same page depending on the link you clicked. Similarly, if you enable a lightbox and your page goes behind a modal image, hitting back will behave exactly the way it should, i.e. take you back to your previous state. I'll go one step further and say that a lightbox implementation that doesn't do this should be considered broken since it breaks user expectations. This does raise the question of judging a user's intent when he presses the back/forward button while there is something modal on his screen, but let's save that for some other time.
- amackera 16y agoSteps to reproduce broken button: 1) Open the demo page 2) Click image 3) Click 'X' in top left of image 4) Click different image 5) Click the 'X' in the top left of image 6) Click browser's 'back' button 7) Observe how you're staring at the image, not the hacker news page you came from. The problem is that clicking the 'X' should pop the image off the stack, not just add another page ("#home") to the stack. Opening an image then hitting back works as it should, though.
- daten 16y agoDoes that make it "broken" or just incompatible with your expectations? Would other non-technical users have the same expectations? It's possible other users will want to go "back" to the image they last visited. Consider if this was done just HTML 4 and no CSS or Javascript. You would click a thumbnail and a new page would be loaded with a full size version of the image. You would then click a "close" button that would take you to the page with the thumbnails again. If you hit "back" you would go back to the image. The way the page currently works follows the "stack" of what I actually visited by clicking links. If I want to reverse my workflow after visiting all 5 images and closing between them, I personally would expect the back button to go through all 5 images. From this perspective, doing the same effect with Javascript that doesn't update the stack might surprise me if after clicking 10 links on this page, a single click of the browser back button skips 10 steps of my workflow and returns me to HN.
- aditya42 16y agoIf the close button had an 'onclick="javascript:history.back()"' attached to it, we wouldn't have this problem :) [We can argue the pureness of the demo after that till the end of time though.]