瀏覽代碼

[Docs] Fix inert example in x-trap (#2310)

* Add inert modifier to x-trap

* Add x-data to inert example
Julius Kiekbusch 3 年之前
父節點
當前提交
6b3d33a6b9
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      packages/docs/src/en/plugins/trap.md

+ 4 - 4
packages/docs/src/en/plugins/trap.md

@@ -191,8 +191,8 @@ By adding `.inert` to `x-trap`, when focus is trapped, all other elements on the
 
 ```alpine
 <!-- When `open` is `false`: -->
-<body>
-    <div x-trap="open" ...>
+<body x-data="{ open: false }">
+    <div x-trap.inert="open" ...>
         ...
     </div>
 
@@ -202,8 +202,8 @@ By adding `.inert` to `x-trap`, when focus is trapped, all other elements on the
 </body>
 
 <!-- When `open` is `true`: -->
-<body>
-    <div x-trap="open" ...>
+<body x-data="{ open: true }">
+    <div x-trap.inert="open" ...>
         ...
     </div>