# Details块不遵守打开规则

**URL:** https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670
**Category:** Bug
**Tags:** hide-details, fixed
**Created:** [2024年十月7日 10:16 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670 "2024-10-07T10:16:45Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2024年十月7日 10:16 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/1 "2024-10-07T10:16:45Z")

</div>

让我们试试

```plaintext
[details open]
这应该是可见的
[/details]

```

> ****
>
> 这应该是可见的

还有

```plaintext

<details open>
这应该是可见的
</details>

```

> ****
>
> 这应该是可见的

我不知道什么时候坏的，因为我不是每天都用它。但是 `[details open]` 以前是有效的。我偶尔会使用 `open` 来分享 AI 对话。

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [2024年十月7日 12:36 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/2 "2024-10-07T12:36:28Z")

</div>

嗯，不幸的是，这看起来像是很久以前的回归问题。

这不会是我们紧急修复的问题，所以暂时添加一个 #pr-welcome。

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2024年十月7日 17:16 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/3 "2024-10-07T17:16:35Z")

</div>

说得有理。

我估计它很少被使用。而且我可以用 `<details>` 和 `<summary>` 来绕过它。我将失去那个很酷的 AI 标签，但也许我能活下来 😭 😂

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2024年十月7日 18:21 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/4 "2024-10-07T18:21:37Z")

</div>

嘿。我一直使用像这样的细节

```plaintext
[details="open"]
This should be visible
[/details]

```

> **open**
>
> This should be visible

我不知道你也可以使用

```plaintext

<details open>
This should be visible
</details>

```

Will try with the =

\<details=“open”\>  
This should be visible

Doesn’t work as above

```plaintext

<details="open">
This should be visible
</details>

```

似乎只像你最后的例子那样工作。

> ****
>
> This should be visible

不过有点酷，因为 \< \> 似乎默认就是打开的。总是在学习新东西）在 discourse 中路由。

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2024年十月7日 19:37 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/5 "2024-10-07T19:37:12Z")

</div>

糟糕。我无法使用 `\u003cdetails open\u003e` 这个技巧，因为我正在使用 [Different look for details-block - #2 by Don](https://meta.discourse.org/t/different-look-for-details-block/320134/2) 这个完全出色的设计。

嗯，我必须等到有懂行的人有时间来解决这个问题。不过，这也不是什么大问题。

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2024年十月8日 00:49 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/6 "2024-10-08T00:49:40Z")

</div>

太棒了！感谢您突出显示 Don 的出色组件！

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2024年十月8日 02:13 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/7 "2024-10-08T02:13:55Z")

</div>

这就行了：

> <https://github.com/discourse/discourse/pull/29116>
>
> Supporting \`open\` allows to show a \`details\` block open by default.
> 
> Usage:
> 
> …
> \`\`\`
> \[details open\]
> my visible content
> \[/details\]
> \`\`\`

我一直在等自助洗衣店 🤷‍♂️

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2024年十月8日 05:14 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/8 "2024-10-08T05:14:05Z")

</div>

那条评论让我的心情好多了 😂

谢谢！

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2024年十月8日 15:45 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/9 "2024-10-08T15:45:36Z")

</div>

我是否应该为你打开 @Don Custom 的隐藏细节？

我得到这个

 ![这张图片显示了一个电脑屏幕，其中包含一个文本框，里面有一个芬兰语短语，一个标有“展开”的按钮，以及一个用于生成图像描述的提示框。（由 AI 标注）](https://global.discourse-cdn.com/meta/original/4X/2/8/5/285ff21d76658ea89ebcc83a97def87c8eb332fb.png)

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2024年十月8日 15:47 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/10 "2024-10-08T15:47:18Z")

</div>

> [@Different look for details-block](https://meta.discourse.org/t/different-look-for-details-block/320134/6?u=moin):
>
> First, I’ve done one hello world thingy using Visual Basic about 20 years ago. And I’ve tuned some WordPress plugins using the try/error method, and once I managed to change every ownership in my VPS, starting from the root. That great solution doesn’t follow [details … open] any more. Connected to that [Details block doesn’t obey open](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670) I reckon. Is the issue coming from this part: cookedDetails.forEach((details) =\> { details.setAttribute("open", ""); Why that? Because it is simil…

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2024年十月8日 16:18 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/11 "2024-10-08T16:18:26Z")

</div>

我看到该主题已打开。它之前已关闭。回答我给 Jag 的问题。谢谢。

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2024年十月11日 16:19 UTC](https://meta.discourse.org/t/details-block-doesn-t-obey-open/329670/12 "2024-10-11T16:19:02Z")

</div>

此主题在上次回复后 3 天自动关闭。不允许新的回复。
