Operator Lookup — Search JavaScript Operators

Handy tool by Josh W. Comeau to look up JavaScript operators. JavaScript Operator Lookup → 🤩 If you’ve been following bram.us for a while you might already know that my favourite operators are the optional chaining operator (.?) and the null coalescing operator (??). Definitely check them out as they will change the way you …

Serverless functions with Vercel

Have a static site but looking to add backendy stuff — such as subscribing to a newsletter — to it? Geoffrey Dhuyvetters from madewithlove walks us trough setting up a serverless function with Vercel (formerly known as Zeit): In this article I’ll walk you through the steps to create serverless functions with Vercel. These functions …

Make <input type="number"> respond to arrow keys with modifier keys

By default <input type="number"> elements will increment/decrement by its step attribute value when pressing the up/down arrows. Kilian Valkhof provides us with some JavaScript to have these elements also respond to up/down keypresses while holding modifier keys. When someone uses the arrow keys in the input field, we want the following to happen: If they …

Go Make Things: Service Workers

Chris Ferdinandi has been writing an excellent post series on Service Workers. After first explaining what Service Workers are and how to create one, he — as per usual on Go Make Things — also provides us with practical scenarios such as making pages available offline, caching web fonts to improve rendering, etc. Go Make …

A Lightweight Masonry Solution

With Masonry being specced in Grid Layout Module Level 2 – and already being implemented in Firefox – Ana Tudor looked into whipping up a lightweight fallback for browsers that don’t support it. 🤔 Masonry Layout? Masonry is a grid layout based on columns, as popularized by Pinterest. Unlike other grid layouts, it doesn’t have …

Refactoring optional chaining into a large codebase: lessons learned

Lea Verou on how Optional Chaining affected her code, along with caveats and scenarios where it couldn’t be used. Now that optional chaining is supported across the board, I decided to finally refactor Mavo to use it. This is a moment I have been waiting for a long time, as I think optional chaining is …

React v17.0: A “Stepping Stone” Release

No new features, but a lot of changes, paving the way for future releases. The React 17 release is unusual because it doesn’t add any new developer-facing features. Instead, this release is primarily focused on making it easier to upgrade React itself. We’re actively working on the new React features, but they’re not a part …

Using JavaScript’s closest() Method to Capture a “Click outside” an Element

In Practical Use Cases for JavaScript’s closest() Method, Andreas Remdt talks about some nice use cases that use Element.closest(). I especially like this example with a menu. Click on one of the links and it will show the menu which has the class menu-dropdown. Clicking outside said menu will close it. It’s that latter one …