True / False ACF control bug on RTL layouts
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 86/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ệ
- css, sass, wordpress
- Lĩnh vực
- frontend, internationalization, localization
Hướng nghiên cứu
Bắt đầu với các quy tắc True/False và .acf-switch trong assets/src/sass/_fields.scss, đối chiếu chúng với các mẫu RTL hiện có; markup nằm trong includes/fields/class-acf-field-true_false.php. Tái tạo switch trong giao diện quản trị WordPress bằng tiếng Hebrew, sau đó xác minh rằng các nhãn vẫn hiển thị và slider được phản chiếu chính xác ở cả hai trạng thái; cập nhật assets/build nếu cần.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
The True/False Stylized UI switch (.acf-switch) renders incorrectly in a Hebrew WordPress admin (html[dir="rtl"]).
On/Off labels are clipped or missing, and the slider knob stays on the physical left instead of following the flipped grid. The control looks like an empty pill.
This is a core CSS bug in the public ACF stylesheet, not a Pro-only issue. The same rules ship in free ACF.
Environment
- WordPress:
7.1.1 - ACF PRO:
6.8.10(also reproduces on free ACF — same CSS) - Site language:
he_IL(Hebrew) - Document direction:
html[dir="rtl"] - Browser:
Brave 1.95.104 (Chromium 153.0.8010.53) - Theme / editor:
classic editor
Steps to reproduce
- Set the site language to Hebrew (
he_IL) sohtmlhasdir="rtl". - Create a field group with a True/False field.
- Enable Stylized UI (
ui => 1). Leave On/Off text at the defaults (Yes/No). - Assign the group to a post type and open that edit screen in wp-admin.
Expected behavior
- The switch shows the On and Off labels.
- When off, the slider sits on the inline-start side (right in RTL).
- When on, the slider moves to the inline-end side (left in RTL).
- Toggling stays readable and mirrored the same way other ACF RTL controls already do.
Actual behavior
- Labels disappear or are clipped (
overflow: hiddenon.acf-switch-on/.acf-switch-off). - The slider stays on the physical left in both states, so the control looks like an empty rounded pill with a knob on the wrong side.
Screenshot: see attached screenshot-rtl-true-false.png.
Why it happens
.acf-switch is display: grid with two columns. Grid does reverse under dir="rtl", so On/Off swap sides.
The slider still uses physical left / right and never gets an html[dir="rtl"] override — unlike many other rules in the same file.
Source:
- Markup:
includes/fields/class-acf-field-true_false.php - Styles:
assets/src/sass/_fields.scss(True / False /.acf-switch)
.acf-switch-slider {
position: absolute;
top: 2px;
left: 2px; /* stays on the physical left in Hebrew */
right: 50%;
transition-property: left, right;
}
&.-on .acf-switch-slider {
left: 50%;
right: 2px;
}
In RTL the columns flip, but the slider still animates as if the page were LTR.
There is no existing issue for this. Related RTL work that ACF already accepted: #22 (RTL for acf-button-group).
Suggested fix
Add an html[dir="rtl"] override next to the existing .acf-switch rules, matching the pattern already used throughout _fields.scss. Do not rewrite the LTR switch to logical properties.
html[dir="rtl"] .acf-switch {
span {
float: right;
}
.acf-switch-slider {
left: 50%;
right: 2px;
}
&.-on .acf-switch-slider {
left: 2px;
right: 50%;
}
+ span {
margin-left: 0;
margin-right: 6px;
}
}
Happy to open a PR against assets/src/sass/_fields.scss (and the compiled CSS in assets/build if that is required).
Related (not blocking)
English field instructions in a Hebrew admin can render with a leading . (Unicode bidi). dir="auto" or unicode-bidi: plaintext on the description would isolate that. Separate from the switch layout bug.
- Ngôn ngữ chính
- PHP
- Star
- 947
- Fork
- 198
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AdvancedCustomFields/acf
-
PHP 8.5: "Using null as an array offset" deprecation in ACF_Data::is() when rendering a block with empty data (local-meta.php is_request)Có thể đã có người làm @faisalahammad đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AdvancedCustomFields/acf#1044 ·
-
is_preview was called incorrectly notice on every early get_field() since 6.8.10 (acf_revisions::acf_validate_post_id)Có thể đã có người làm @faisalahammad đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AdvancedCustomFields/acf#1041 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AdvancedCustomFields/acf#1034 · 3 bình luận ·
-
Bug: class-acf-field-icon_picker.php calls wp_get_attachment_image_url() with string Dashicon slug, causing fatal TypeError on PHP 8+Có thể đã có người làm @antwonw đã nhận 50 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
AdvancedCustomFields/acf#1032 · 1 bình luận ·
-
Drop trap, acf_after_titleCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AdvancedCustomFields/acf#1029 · 1 bình luận ·
Tất cả issue của AdvancedCustomFields/acf
Issue tương tự
-
bug review needed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
OpenMage/magento-lts#5816 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
priority:low type:docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
crazy-goat/rabbit-stream#958 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nextcloud/richdocuments#6250 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày