Reduced Position Sticky | scottohara.me

Reduced Position Sticky

Published:

Mar 27, 2019

Last night I added a reduced motion media query for the header of the primary content of my website. I am using position: sticky (and position: -webkit-sticky for Safari) to make the content obscure the header, on scroll.

Since such behavior could be considered a form of parallax scrolling, I am cognizant of the fact it may be a triggering issue for some people. Therefore, I want to respect those who have opted to prefer reduced motion.

Adding prefers reduced motion media query

It’s rather simple to implement the media query, which respects the macOS system preference for reduced motion:

@media screen and (prefers-reduced-motion: reduce) {
.article-header-class {
position: relative; /* to negate sticky */
}
}

Enabling this feature on macOS can be done by going to System Preferences, Accessibility, Display, and then checking the Reduced Motion checkbox.

With the media query in place, and the reduced motion checkbox checked, the header element is no longer sticky and scrolls away per standard functionality.

And some more info

I’d also recommend reading through through @patrick_h_lauke’s Twitter thread about reduced motion landing in Chrome [...]

Read article at scottohara.me

Article Taxonomies

Categories:
Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /home/webable/www/www/wp-content/themes/webable/content-mcm.php:65 Stack trace: #0 /home/webable/www/www/wp-includes/template.php(812): require() #1 /home/webable/www/www/wp-includes/template.php(745): load_template('/home/webable/w...', false, Array) #2 /home/webable/www/www/wp-includes/general-template.php(206): locate_template(Array, true, false, Array) #3 /home/webable/www/www/wp-content/themes/webable/single-mcm_article.php(15): get_template_part('content-mcm') #4 /home/webable/www/www/wp-includes/template-loader.php(106): include('/home/webable/w...') #5 /home/webable/www/www/wp-blog-header.php(19): require_once('/home/webable/w...') #6 /home/webable/www/www/index.php(17): require('/home/webable/w...') #7 {main} thrown in /home/webable/www/www/wp-content/themes/webable/content-mcm.php on line 65