Skip to content

Instantly share code, notes, and snippets.

View gchartier's full-sized avatar
💠
Discovering Patterns

Gabriel Chartier gchartier

💠
Discovering Patterns
View GitHub Profile
@gchartier
gchartier / gist:96e066df1219adc352304be4144b5a0f
Created October 15, 2021 21:03
sr-only class for accessibility
const visuallyHidden = {
position: 'absolute',
overflow: 'hidden',
clip: 'rect(0 0 0 0)',
height: '1px',
width: '1px',
margin: '-1px',
padding: 0,
border: 0,
}
@gchartier
gchartier / gist:07d88e911f335aff795cca313258c10e
Created October 13, 2021 18:22
Sticky Element Parent Overflow Finder
// Replace this with a relevant selector.
// If you use a tool that auto-generates classes,
// you can temporarily add an ID and select it
// with '#id'.
const selector = '.the-fixed-child';
function findCulprits(elem) {
if (!elem) {
throw new Error(
'Could not find element with that selector'
);
@gchartier
gchartier / gist:61f4a6c47e7117840d94e173d522a4ad
Created October 13, 2021 13:46
Fixed Element Transform Parent Finder
// Replace this with a relevant selector.
// If you use a tool that auto-generates classes,
// you can temporarily add an ID and select it
// with '#id'.
const selector = '.the-fixed-child';
function findCulprits(elem) {
if (!elem) {
throw new Error(
'Could not find element with that selector'
);