Skip to content

Instantly share code, notes, and snippets.

@mattandrews
Created July 24, 2017 14:54
Show Gist options
  • Save mattandrews/ea04879476179cd9b386a9d989c808cb to your computer and use it in GitHub Desktop.
Save mattandrews/ea04879476179cd9b386a9d989c808cb to your computer and use it in GitHub Desktop.
on-interact Sass mixin
// use this where you'd otherwise use '&:hover'
// to get accessible styling for keyboard navigation too
@mixin on-interact {
&:active,
&:focus,
&:hover {
@content;
}
}
// usage:
.some-element {
background-color: red;
@include on-interact {
background-color: blue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment