Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mxmason's full-sized avatar

EJ Mason mxmason

View GitHub Profile
@pizzarob
pizzarob / xhr.js
Created August 21, 2016 18:45
Helper Functions for Making XHR Requests in JavaScript
function post(url, data) {
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.addEventListener('load', () => {
let { response, status } = xhr;
let res = JSON.parse(response);
if(status >= 200 && status < 400){
@fpapado
fpapado / README.md
Last active June 22, 2021 19:50
:focus-visible progressive enhancement mixin

Find the full post on fotis.xyz

:focus-visible is a standard way of only showing focus styles for keyboard and focus-based modalities. When using it, however, you must take care to not remove :focus altogether, where :focus-visible is not supported.

With CSS, we can achieve progressive enhancement of :focus to :focus-visible:

/* Styles where only focus is supported */
button:focus,