mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
EmptyState: Don't apply animation when prefers-reduced-motion
is set (#87638)
* don't apply animation when prefers-reduced-motion is set * bail quicker * early return
This commit is contained in:
parent
b214f9cc3a
commit
2cdb7d923f
@ -24,6 +24,11 @@ export const GrotNotFound = ({ width = 'auto', height }: Props) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMouseMove = (event: MouseEvent) => {
|
const handleMouseMove = (event: MouseEvent) => {
|
||||||
|
// don't apply animation if reduced motion preference is set
|
||||||
|
if (window.matchMedia('(prefers-reduced-motion: reduce').matches) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const grotArm = svgRef.current?.querySelector('#grot-not-found-arm');
|
const grotArm = svgRef.current?.querySelector('#grot-not-found-arm');
|
||||||
const grotMagnifier = svgRef.current?.querySelector('#grot-not-found-magnifier');
|
const grotMagnifier = svgRef.current?.querySelector('#grot-not-found-magnifier');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user