Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Block v3 placeholders sometimes missing

オープン
#1,007 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
php
領域
frontend

調査の方向性

まず、ACF-attribute element 内に空白がある block v3 のインライン編集ケースを再現し、次にリンクされたスクリーンショットに示されている CSS ルールとプレースホルダーの挙動を調べます。完了条件は、template にフォーマット用の空白が含まれている場合でも、空のフィールドでプレースホルダーが表示されたままになることです。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
When using inline editing in blocks v3, the placeholder can sometimes be missing. This is because the placeholder is shown via CSS when the target element is :empty, but whitespace in the code can prevent :empty from working.

To Reproduce
Steps to reproduce the behavior:

  1. In the render template, include whitespace in the element with the ACF attributes.
  2. The editor experience can be buggy as shown in the video below.
  3. Remove the whitespace in the template and the placeholder is more stable.

Expected behavior
The placeholder should be visible when the field is empty, not the element, because the element can have whitespace due to code formatting.

Screenshots or Video
CSS rule: https://screenshot.electricpulp.com/CKLzlHfq9h4CZkpXcyMF
Whitespace preventing the rule: https://screenshot.electricpulp.com/62ljqcQnnJ0ynCfND65l
Preheading without white space (stable), heading with white space (unstable): https://screenshot.electricpulp.com/fDbBddzyyL6LTC8kjcV5

Code
Tabbed/intended code causes instability:

<div class="hero__preheading" <?= acf_inline_text_editing_attrs('pre_heading', ['placeholder' => 'Add a pre heading (optional)']); ?>>
    <?= get_field('pre_heading') ?>
</div>

Whitespace removed works:

<div class="hero__preheading" <?= acf_inline_text_editing_attrs('pre_heading', ['placeholder' => 'Add a pre heading (optional)']); ?>><?= get_field('pre_heading') ?></div>

Version Information:

  • WordPress Version 6.9.4
  • PHP Version 8.2
  • ACF Pro 6.7.1
  • Chrome Version 146.0.7680.154

Additional context
Possible solution: rather than relying on :empty, check the field value for non-null and then toggle a class on the target element. The ::before used for the placeholder can then be shown with that class.

主要言語
PHP
スター
946
フォーク
197
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AdvancedCustomFields/acf のほかの issue

AdvancedCustomFields/acf の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。