Toggle Menu div not hidden

Hey guys I have this toggle menu but the div is still visible like people can scroll right and see the menu any one knows how to fix that code below

You haven’t actually hidden it. Setting it to position absolute and moving it to the side doesn’t hide it.

const hideToggle = {
  transform: 'translateX(100%)',
  display: 'none'
}

If you want it to animate in from the side you may have to collapse it and hide it. Just know that may not be great for accessibility (it might get read), I think if you use aria-hidden='true' on it (when it is hidden obviously) it should fix that.

const hideToggle = {
  transform: 'translateX(100%)',
  height: 0,
  width: 0,
  overflow: "hidden"
}
1 Like