Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Block v3 placeholders sometimes missing

Đang mở
#1,007 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
php
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện trường hợp chỉnh sửa nội tuyến của block v3 với khoảng trắng trong ACF-attribute element, sau đó kiểm tra quy tắc CSS và hành vi của placeholder được thể hiện trong các ảnh chụp màn hình được liên kết. Được xem là hoàn tất khi placeholder vẫn hiển thị đối với một trường trống ngay cả khi template chứa khoảng trắng định dạng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
947
Fork
197
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AdvancedCustomFields/acf

Tất cả issue của AdvancedCustomFields/acf

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.