Skip to content

Commit 6b0a492

Browse files
fix: prevent CodePens from stealing focus and scrolling the page (#1047)
1 parent 48dd23e commit 6b0a492

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/guide/component-basics.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Components can be reused as many times as you want:
5454
</div>
5555
```
5656

57-
<common-codepen-snippet title="Component basics: reusing components" slug="rNVqYvM" tab="html,result" :preview="false" />
57+
<common-codepen-snippet title="Component basics: reusing components" slug="rNVqYvM" tab="result" :preview="false" />
5858

5959
Notice that when clicking on the buttons, each one maintains its own, separate `count`. That's because each time you use a component, a new **instance** of it is created.
6060

@@ -111,7 +111,7 @@ Once a prop is registered, you can pass data to it as a custom attribute, like t
111111
</div>
112112
```
113113

114-
<common-codepen-snippet title="Component basics: passing props" slug="PoqyOaX" tab="html,result" :preview="false" />
114+
<common-codepen-snippet title="Component basics: passing props" slug="PoqyOaX" tab="result" :preview="false" />
115115

116116
In a typical app, however, you'll likely have an array of posts in `data`:
117117

@@ -227,7 +227,7 @@ Then the child component can emit an event on itself by calling the built-in [**
227227

228228
Thanks to the `@enlarge-text="postFontSize += 0.1"` listener, the parent will receive the event and update the value of `postFontSize`.
229229

230-
<common-codepen-snippet title="Component basics: emitting events" slug="KKpGyrp" tab="html,result" :preview="false" />
230+
<common-codepen-snippet title="Component basics: emitting events" slug="KKpGyrp" tab="result" :preview="false" />
231231

232232
We can list emitted events in the component's `emits` option:
233233

src/guide/component-dynamic-async.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Earlier, we used the `is` attribute to switch between components in a tabbed int
1212

1313
When switching between these components though, you'll sometimes want to maintain their state or avoid re-rendering for performance reasons. For example, when expanding our tabbed interface a little:
1414

15-
<common-codepen-snippet title="Dynamic components: without keep-alive" slug="jOPjZOe" tab="html,result" :preview="false" />
15+
<common-codepen-snippet title="Dynamic components: without keep-alive" slug="jOPjZOe" tab="html,result" />
1616

1717
You'll notice that if you select a post, switch to the _Archive_ tab, then switch back to _Posts_, it's no longer showing the post you selected. That's because each time you switch to a new tab, Vue creates a new instance of the `currentTabComponent`.
1818

@@ -27,7 +27,7 @@ Recreating dynamic components is normally useful behavior, but in this case, we'
2727

2828
Check out the result below:
2929

30-
<common-codepen-snippet title="Dynamic components: with keep-alive" slug="VwLJQvP" tab="html,result" :preview="false" />
30+
<common-codepen-snippet title="Dynamic components: with keep-alive" slug="VwLJQvP" tab="html,result" />
3131

3232
Now the _Posts_ tab maintains its state (the selected post) even when it's not rendered.
3333

src/guide/events.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Vue.createApp({
2525

2626
Result:
2727

28-
<common-codepen-snippet title="Event handling: basic" slug="xxGadPZ" tab="html,result" :preview="false" />
28+
<common-codepen-snippet title="Event handling: basic" slug="xxGadPZ" tab="result" :preview="false" />
2929

3030
## Method Event Handlers
3131

@@ -62,7 +62,7 @@ Vue.createApp({
6262

6363
Result:
6464

65-
<common-codepen-snippet title="Event handling: with a method" slug="jOPvmaX" tab="js,result" :preview="false" />
65+
<common-codepen-snippet title="Event handling: with a method" slug="jOPvmaX" tab="result" :preview="false" />
6666

6767
## Methods in Inline Handlers
6868

@@ -87,7 +87,7 @@ Vue.createApp({
8787

8888
Result:
8989

90-
<common-codepen-snippet title="Event handling: with an inline handler" slug="WNvgjda" tab="html,result" :preview="false" />
90+
<common-codepen-snippet title="Event handling: with an inline handler" slug="WNvgjda" tab="result" :preview="false" />
9191

9292
Sometimes we also need to access the original DOM event in an inline statement handler. You can pass it into a method using the special `$event` variable:
9393

src/guide/forms.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Multiple select (bound to array):
157157
<span>Selected: {{ selected }}</span>
158158
```
159159

160-
<common-codepen-snippet title="Handling forms: select bound to array" slug="gOpBXPz" tab="html,result" :preview="false" />
160+
<common-codepen-snippet title="Handling forms: select bound to array" slug="gOpBXPz" tab="result" :preview="false" />
161161

162162
Dynamic options rendered with `v-for`:
163163

src/guide/list.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ methods: {
217217

218218
Result:
219219

220-
<common-codepen-snippet title="v-for with a range" slug="NWqLjNY" tab="html,result" :preview="false" />
220+
<common-codepen-snippet title="v-for with a range" slug="NWqLjNY" tab="html,result" />
221221

222222
## `v-for` on a `<template>`
223223

0 commit comments

Comments
 (0)