Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bard: dropdown menu of a newly inserted set closes immediately (can't delete/collapse/duplicate the set)

已关闭
#15,704 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #15709 来自 @o1y —— 已合并

评估

难度
4/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
laravel, php
领域
backend, frontend

调研方向

Start by tracing the Bard set dropdown and its node view, then inspect how ProseMirror's DOMObserver handles the aria-hidden attribute mutations described in the issue. Reproduce by inserting a set containing a Grid and opening its menu; compare the newly inserted set with a saved and reloaded set. Done means the menu stays open after insertion and its actions work without losing the node view.

由索引模型根据 Issue 内容生成。

描述

bard
Bug description

After inserting a new set into a Bard field, the set's "…" dropdown (Collapse / Duplicate / Delete Set) does not open. Clicking the trigger does nothing visible. The same happens for dropdowns inside the set, e.g. the row actions of a Grid field within the set.

Sets that were already saved are not affected. Their dropdown opens normally, even when expanded or after their fields were edited. Once the entry is saved and reloaded, the dropdown of the previously "new" set works again.

Expected: the dropdown opens and the set can be deleted right after inserting it.

What I found while debugging:

  • The set's dropdown is a modal Reka dropdown (DropdownMenuRootContext.modal === true).
  • Clicking the trigger sets open to true. The menu content is mounted into body and removed again in the same tick.
  • At that moment aria-hidden / data-aria-hidden get set on the editor's top-level children (h1, p, h2, … inside .ProseMirror), apparently from the modal "hide others" behaviour.
  • ProseMirror's DOMObserver registers these attribute mutations as DOM changes and marks the range dirty. DOMObserver.flush() → view.updateState() → docView.updateChildren() → destroyRest() then destroys the set's node view. No transaction is dispatched.
  • The Vue component of the set (including the open dropdown) is unmounted and a fresh instance is rendered with the dropdown closed.

So the modal dropdown mutates attributes inside the ProseMirror DOM, ProseMirror re-renders that range, and the re-render destroys the node view that owns the dropdown. For saved sets the node view seems to survive the re-render, which is why only freshly inserted sets are affected.

How to reproduce
  1. Create a Bard field with a set containing a Grid (any fields will do), e.g.:

    handle: text
    field:
      type: bard
      sets:
        main:
          sets:
            buttons:
              fields:
                -
                  handle: buttons
                  field:
                    type: grid
                    min_rows: 1
                    fields:
                      - { handle: label, field: { type: text } }
                      - { handle: link, field: { type: link } }
    
  2. Open an entry with this field in the CP.

  3. Place the cursor on an empty line in the Bard field and insert the set.

  4. Click the "…" button in the header of the newly inserted set.

  5. The dropdown does not open, so the set can't be deleted, collapsed or duplicated.

  6. Save and reload the entry, then click "…" again. Now the dropdown opens.

Logs

Environment
Environment
Laravel Version: 13.38.0
PHP Version: 8.5.12
Composer Version: 2.10.3
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/Berlin
Locale: de

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: sqlite
Logs: debug / single
Mail: sendmail
Queue: sync
Session: file

Storage
public/storage: LINKED

Statamic
Addons: 5
License Key: Not set
Sites: 5 (German, English (US), English, Hungary, Spanish)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.36.0 PRO

Statamic Addons
heidkaemper/statamic-toolbar: 1.7.0
jacksleight/statamic-bard-texstyle: 4.2.4
ndx/statamic-bard-color-picker: 3.1.0
ndx/statamic-simple-redirects: 1.4.0
spatie/statamic-responsive-images: 6.2.0
Installation

Fresh statamic/statamic site via CLI

Additional details

No response

主要语言
PHP
星标
4.9k
派生
647
平均合并
1 天 11 小时
30 天内合并 PR
138

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

statamic/cms 的其他 Issue

查看 statamic/cms 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。