Skip to content

The pseudo class ":first-child" is potentially unsafe when doing server-side renderingΒ #13639

@dimafirsov

Description

@dimafirsov

mapbox-gl-js version

3.20.0

Browser and version

Chrome 146.0.7680.80

Context:

Product: ui library
Stack: React, Typescript, Emotion

Expected behavior

Use :first-of-type instead of :first-child.

Actual behavior

The imported mapbox-gl.css file causes Emotion to log this error to the console:

The pseudo-class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type".

Image

The error looks valid. The current version of the mapbox-gl.css file still has that pseudo-selector:
https://github.com/mapbox/mapbox-gl-js/blob/main/src/css/mapbox-gl.css

Link to the demonstration

Link to reproduce

Steps to trigger the unexpected behavior

  1. Navigate the link above
  2. Wait for the project to set up
  3. Open the DevTools's console
  4. Observe a result
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions