Color palette as CSS variables logs wp.components.Theme warnings in the Site Editor

Đang mở
#32 0 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
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, wordpress
Lĩnh vực
design, frontend

Hướng nghiên cứu

Start by reading the settings.color.palette entries in theme.json and note which ones are var(--nv-…, #hex) values (ti-bg, ti-fg, and the rest). Then find where Assets_Manager prints the inherited inline CSS so the --wp--preset--color--ti-* overrides can move there. Done looks like literal hex values in the palette, Neve-migrated sites still showing Neve's colours, and no wp.components.Theme warnings in the Site Editor console with SCRIPT_DEBUG on.

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

Mô tả

bug
Description

The theme's colour palette is defined as CSS variables, which the Site Editor's own colour handling can't read. Every time the Site Editor opens, the browser console shows three warnings:

wp.components.Theme: "var(--nv-text-color, #202020)" is not a valid color value for the 'accent' prop.
wp.components.Theme: "var(--nv-site-bg, #FFFFFF)" is not a valid color value for the 'background' prop.
wp.components.Theme: The background color ("var(--nv-site-bg, #FFFFFF)") does not have sufficient contrast against the accent color ("var(--nv-text-color, #202020)").

Every entry of theme.json settings.color.palette is a var(--nv-…, #hex) value, so that a site coming from Neve inherits Neve's colours (ti-bg is var(--nv-site-bg, #FFFFFF), ti-fg is var(--nv-text-color, #202020), and so on). The Site Editor passes the palette's background and foreground to wp.components.Theme, which expects literal colours. So it can't compute the canvas UI's colours or the contrast check from them.

Step-by-step reproduction instructions
  1. With Eduacademy 1.0.1 active and SCRIPT_DEBUG on, go to Appearance → Editor.
  2. Open the browser console.

Expected: no warnings from the theme's palette.
Actual: the three wp.components.Theme warnings above, on every Site Editor load, and on every template or part opened in it.

Screenshots, screen recording, code snippet or Help Scout ticket

Possible fix: keep literal hex values in theme.json's palette, and apply the Neve overrides through the inherited inline CSS that Assets_Manager already prints (overriding the --wp--preset--color--ti-* variables there). The palette entries would then be real colours, while a site coming from Neve still gets Neve's colours.

Found while adding Eduacademy to the WordPress compatibility checks (Codeinwp/qa-compatibility#168). Seen on WordPress 7.0.9, 7.1-RC1 and 7.1.5 alike.

Environment info

Eduacademy 1.0.1 (built from the v1.0.1 tag), WordPress 7.0.9 / 7.1-RC1 / 7.1.5, PHP 8.3, SCRIPT_DEBUG on, Chromium.

Is the issue you are reporting a regression

No

Ngôn ngữ chính
PHP
Star
0
Fork
0
Merge trung bình
22 giờ 12 phút
Pull request đã merge (30 ngày)
6

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 Codeinwp/eduacademy

Tất cả issue của Codeinwp/eduacademy

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.