Skip to content

useA11y() not working as expected #23

Answered by pi43r
pi43r asked this question in Q&A
Discussion options

You must be logged in to vote

Ahhh, yes.
I think I answered my own question :)
For useA11y to work correct, it has to be encapsulated in it's own component like this <A11y> <Component \> </A11y>.
Originally I was using it like this, which does not work.

<A11y
    role='link'
    href={route}
    actionCall={() => {
      router.push(route)
    }}
  >
    <mesh
      ref={mesh}
      onPointerOver={(event) => setHover(true)}
      onPointerOut={(event) => setHover(false)}
    >
      <boxGeometry args={[1, 1, 1]} />
      <meshBasicMaterial
        // changed hovered to a11y functions
        //color={hovered ? 'hotpink' : color}
        color={a11y.focus || a11y.hover ? 'hotpink' : color}
      />
    </mesh>
</A11y>

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@AlaricBaraou
Comment options

Answer selected by pi43r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants