Block v3 placeholders sometimes missing
まだ誰も着手していません。
評価
調査の方向性
まず、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:
- In the render template, include whitespace in the element with the ACF attributes.
- The editor experience can be buggy as shown in the video below.
- 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AdvancedCustomFields/acf のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
AdvancedCustomFields/acf#1041 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
AdvancedCustomFields/acf#1038 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
AdvancedCustomFields/acf#1034 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
AdvancedCustomFields/acf#1032 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
AdvancedCustomFields/acf#1029 · コメント 1 件 ·
AdvancedCustomFields/acf の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
UX
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ProfessionalWiki/NeoWiki#1573 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
endoflife-date/endoflife.date#11194 ·
メンテナーはふだん 1 日以内に返信