使用 gatsby-background-image 时选项卡悬停上的黑色轮廓

问题描述

我将 gatsby-background-image 与 Gatsby v3 一起使用,但由于某种原因,每当我将鼠标悬停在另一个标签上时,都会出现黑色轮廓

outlines

我不确定我的代码是否有问题,或者是插件本身有问题。我删除了 CSS 无济于事,所以这不是问题。

const ImageSlider = (props) => {

  const [sliderIndex,setSliderIndex] = useState(0);
  const images = ['../images/1.png','../images/2.png']

  const {backgroundImage} = useStaticQuery(graphql`
    query {
      backgroundImage: file(relativePath: {eq: "1.png"}) {
        id
        childImageSharp {
          gatsbyImageData(
            width: 1360,quality: 50,webpOptions: {quality: 70}
          )
        }
      }
    }
  `)

  const image = getimage(backgroundImage)
  const bg = convertToBgImage(image)

  return (
    <div className={styles.imgSlider}>
      <BackgroundImage Tag="section" {...bg} className={styles.bgImg}>
        {props.children}
      </BackgroundImage>
    </div>
  )
}

解决方法

我的解决方案是将 preserveStackingContext 设置为 true

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...