vuejs / theme

VitePress theme for vuejs.org.
MIT License
245 stars 87 forks source link

fix: avoid setting margin-top for code samples in an edge case #64

Closed skirtles-code closed 2 years ago

skirtles-code commented 2 years ago

The selector for setting a negative margin-top is intended to handle consecutive code samples. However, the part of the selector intended to handle samples nested inside class="options-api" or class="composition-api" is currently matching all code samples, when it should just be matching those at the start.

I've added :first-child so that other code samples are not impacted.

In the current Vue 3 docs there is only one place where this makes a difference. It's in https://vuejs.org/guide/components/events.html, when viewed in Options API mode.

Before (see red arrow):

image

After:

image