Since the release of Gutenberg as the content editor, and now full site experiences, WordPress has moved to using default styles and the theme.json configuration to manage styles for your theme. There are times when this is not enough since there are things that you can't do in the editor. If you're working on bespoke sites or sites using animations and specific font features you will need finer control than what the editor provides. The post will cover some of these areas and why using CSS or Javascript is the better solution. OpenType Features OpenType fonts provide a series of...
With flexbox and grid supported in all major browsers, I see variations of these questions asked a lot: what should I use, flexbox or grid? or which one is better flexbox or grid? The question is deceptively simple, the answer is anything but. The answer is: It depends. Grid and flexbox serve different purposes. Flexbox Flexbox works on one axis, either rows or columns but not on both axes at the same time. Whether it's a row flexbox layout css .wrap { display: flex; flex-flow: row wrap; } Or a column flexbox layout css .wrap { display: flex; flex-flow: column...
I've finally given in to working with TypeScript despite some of my misgivings about the technology. My misgivings include: The need to set up a transpiler toolchain You can't run the code directly in the browser You have to decide on what version of Javascript to transpile the code to. This decision will be hardcoded in the Typescript configuration file We'll look at the setup and configuration of a Typescript project, along with some gotchas I've learned along the way. These instructions assume you've initialized a package.json file. Installing Typescript You have two options to configure Typescript. You can install...
Landmarks, or what I call structural elements, help define the structure of a document and help accessibility tools like screen readers describe the content to users. The following table shows the HTML elements used to describe document landmarks, the associated ARIA roles and a description of what the landmark accomplishes. | HTML element | Implicit ARIA Role | Description | | --- | --- | --- | | aside | complementary | Shows complementary content to the main subject of the page | | footer | contentinfo | Displays information about a page. Typically that's things like copyright info, related...
When you use libraries like jQuery from CDN, you will see code like when you get the CDN link: html I've always been curious as to what is the integrity attribute, why is it there and why do we need the crossorigin attribute. This post will look at crossorigin integrity and how it can help secure web applications. Crossorigin integrity According to the Subresource Integrity Specificationhttps://w3c.github.io/webappsec-subresource-integrity/: > Sites and applications on the web are rarely composed of resources from only a single origin. For example, authors pull scripts and styles from a wide variety of services and content delivery networks,...
This post outlines my early thoughts on certifications as they relate to WordPress. I'm coming into the conversation as an instructional designer and curriculum developer and someone who has worked building curricula for certifications. I don't believe it matters if the product we're building a certification program for is open source or not. While there may be some idiosyncracies to open source products the certification should be the same as it is for commercial software in terms of rigor and how it is built. Overview: Why do we need certification In most situations, being certified means that you've mastered a...
In Javascript, the intlhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/GlobalObjects/Intl object provides several locale-aware tools to work with in Javascript. One of those tools is the segmenterhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/GlobalObjects/Intl/Segmenter object. The segmenter object enables locale-aware segmentation from a string with selectable granularity grapheme, word and sentence. a grapheme is a single character, regardless of how many codepoints it takes to display it. "🫵" is one grapheme, so is a space " " Words and sentences are self-explanatory. We first create a segmenter object with two parameters: A valid language code and the granularity that we want to use. For this example, we're using word as the granularity. js...
As I was writing my previous post about Playwright and writing tests I came across an articlehttps://www.checklyhq.com/blog/how-playwright-can-monitor-third-party-resources/ that explained how to run performance measurements inside Playwright tests. Core Web Vitals The example runs against your app's local server and will generate the Largest Contentful Painthttps://web.dev/articles/lcp value using performance observershttps://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver combined with Playwright commands. Because the local server will not act like your regular server there are no network requests the results will be significantly faster than they would be against your production site. You should take this into account when evaluating the tests and, if possible, should also test against...
Several times I've found myself working with fonts where I want to know what's available in the font without using tools like Wakmaifonduehttps://wakamaifondue.com/. Recently, I discovered fontkit.jshttps://github.com/foliojs/fontkit/, a tool that will read and manipulate fonts so I decided to use it in a test script to see what a given font has available to use. This is a node script so it assumes one of two things: - there is a package.json where you've installed fontkit - You've installed fontkit globally The script also imports the argvhttps://nodejs.org/docs/latest/api/process.htmlprocessargv from the built-in process module to capture the full path to the font...
Most of the work I've seen done in the console is limited to console.log. There is a lot more that you can do with the console. There's even a living standard hosted at WHATWG. Most of the time we just use console.log to print something to the DevTools console. And that's enough, but sometimes we can do more. I was surprised to find out that there is a specification for the console APIhttps://console.spec.whatwg.org that shows some amazing things you can do with the console. Caveats: The console specification is an early work that documents existing functionality in browsers I will...