Hacker Newsnew | past | comments | ask | show | jobs | submit | kcrwfrd_'s commentslogin

Yes you could, or even just a vanilla DOM event handler on a button click.

The problem is that you cannot introspect the browser’s history with the history API. So you have to hack your way around that if you want the “go back in history if possible, otherwise navigate to fallback url” behavior. Which I guess is easier if you’re in a react SPA. Or if you’re fully a MPA and can just check document.referrer

There’s a brand new Navigation API that does let you introspect history entries from the same origin, which perfectly addresses the issue.

I wrote a polyfill in order to take advantage of the navigation API for this exact problem: https://github.com/kcrwfrd/navigation-ponyfill


They are actually speaking to trying to make an in-app back button use the history stack so that it _doesn’t_ “break” your browser’s back button.

The problem with just calling history.back() with no fallback is it will bounce users out of your app (back to Google or wherever they came from) and PMs won’t like that…


`history.back()` shouldn't even exist, it's almost never correct to use it instead of a logical back button that works on the logical navigation structure e.g. going up a level, or to the previous page, etc.

For example, if you are on Page 5, then pressing "back" inside the app should always take you to Page 4. `history.back()` could take you to any page, it's unpredictable.


Disagreed. In everyday speech "going back" means going to where you came from. If I'm at a friend's place at 123 Main Street and I tell him I'm going back, what I'm saying is I'm heading back to my home, not to 122 Main Street. The web should work similarly.

And the idea of logical navigation is flawed because most websites don't have a well defined logical structure, nor is it feasible to have one. What is the previous page of a Wikipedia article, or an HN submission, or an Amazon listing, or a search result of cheapest direct flights between New York and Cancun? With how the back button currently works, at least there is consistency in what to expect when clicking it. Under your suggestion, there is no way a user knows what the back button does on each website unless he clicks on it first and find out himself.


I'm not talking about the back button. I'm talking about history.back() API. If you have a "back" button that is inside the page's viewport, it should work based on the page's logical model. So you go back from Page 5 to Page 4, regardless of where you were before. Only back buttons outside the viewport should work based on browser history. The history is part of the browser it's not part of the page.

It’s really common that you can arrive on a view from different places.

For example on instagram you might click through to a post from the explore page or from someone sending it to you via DM. In either case pressing the back button rendered in the app, or swiping back, will take you back to where you came from. It feels natural and seamless. Although I guess there are other ways to skin that cat than history.back()

But I agree with you when there’s a clear hierarchy. Like on a job ad a “back” button should just be a normal link to the index of job openings.


As someone who went through that same journey, agreed.

Compared to previous paradigms, React lets you compose complexity and rich interactivity really, really well. Even for all its flaws.


I’ve also been writing CSS professionally for nearly 20 years and am a big fan of tailwind.

The ergonomics in my day to day work are quite nice. To me, the better boundary of abstraction shifted to components, rather than the html/css/js “separation of concerns” that some of the older folks still like to parrot.

However, take a look at the markup and styling for the https://maps.apple.com/ web property.

I can’t deny that it’s quite beautiful and easy to holistically understand. Especially when it comes to the responsive styling—which is when I tend to find tailwind most awkward.

It’s my favorite example of “traditional” CSS structure in recent memory that has given me some pause when it comes to Tailwind.


For what it’s worth I like to encapsulate things in components and still separate out the CSS from the markup.

In my mind it’s the best of both worlds. Vue makes it easy. I think CSS modules in React work similarly


In case anyone else is going crazy trying to find this setting, it’s called slide to type


AHH thank you!!


Aphex Twin, Selected Ambient Works 85-92

Boards of Canada

Mr. Robot Original Soundtrack


For a human this advice is true. But what if a computer can near-instantly calculate a perfect swerve within the performance envelope of the car and driving conditions?


What was the verdict on the smoothie?


He said it was overpriced but bought it again from a different Erewhon so I assumed he liked it (Canadian understatement).

There's apparently a quality gap between locations. The pre-Waymo one was from Erewhon Grove and was freshly blended. Erewhon Beverly Hills on Rodeo Drive premade a bunch of them and left them lying around for a while before selling.

My brother's theory is that Erewhon Grove customers are people who legitimately wanted a smoothie and Erewhon Beverly Hills customers just want photos with the smoothie since it was very popular on Instagram at the time.

Most surprising fact was despite being a licensed product, it was better than the best non-licensed smoothie (coconut cloud).

Licensing deals should make the product worse because the royalties cut into the product margin. The company cuts costs or doesn't take creative risks as a result. But somehow Erewhon resisted these pressures when designing the Hailey Bieber smoothie. We had a discussion about why that was the case but couldn't come up with an answer.


I think they have rotating specials. These are pre-made, cheaper, and smaller. When you have a membership this is the one you get for free (once a month).

They used to have a “Dr. Paul's Raw Animal-Based Smoothie” that I looooved, but unfortunately they stopped making it. Still sad about that one :(


I despair at not being able to easily send a window to another space with a keyboard shortcut on macOS.

Yabai supports this perfectly (especially combined with instant, animation-free space switching) but it requires disabling system integrity protection--which is a non-starter on a work computer.

Aerospace solves it with their own spaces implementation.

I was able to put together a hammerspoon script that does the job decently enough for my purposes: https://gist.github.com/kcrwfrd/6f3dcaec0e08e0e77b2884588a34...


Aerospace is the least bad option


> Still no support for multiple inputs

It looks like a nice display, but that’s a deal killer for me.


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

Search: