rx.input(auto_complete=...): a bool is dropped by React, and a string raises a TypeError
Maintainer thường phản hồi trong vòng 2 ngày
Một pull request liên quan đã được merge.
- #7418 của @benedikt-bartscher — đã merge
Đá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
- 72/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc TextFieldRoot trong text_field.py và so sánh khai báo auto_complete của nó với khai báo của phần tử cha elements.Input. Kiểm tra các bài kiểm thử thành phần liên quan hoặc bổ sung kiểm thử cho rx.input(auto_complete="off"). Hoàn thành khi chuỗi được chấp nhận và hiển thị dưới dạng autoComplete:"off", phù hợp với hành vi được mong đợi trong issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
rx.input (TextFieldRoot) declares auto_complete: Var[bool], but the HTML autocomplete attribute takes a string ("on", "off", or autofill tokens such as "email"). Its parent elements.Input declares auto_complete: Var[str], and so does the generated stub for rx.input. As a result, neither form works:
rx.input(auto_complete=False) # renders autoComplete:false, which React drops
rx.input(auto_complete="off") # TypeError: Invalid var passed for prop TextFieldRoot.auto_complete, expected type <class 'bool'>, got value off of type <class 'str'>.
React 19 renders <input autoComplete={false}/> as a bare <input/> and warns "Received false for a non-boolean attribute autoComplete". It does the same for true; only strings reach the DOM. So the prop can't turn browser autocomplete off, and type checkers, which read the stub, accept only the strings that fail at runtime.
To Reproduce
import reflex as rx
rx.input(auto_complete="off") # TypeError
print(rx.input(auto_complete=False)) # jsx(RadixThemesTextField.Root,{autoComplete:false},)
Expected behavior
rx.input(auto_complete="off") renders autoComplete:"off", like rx.el.input(auto_complete="off") does.
Specifics (please complete the following information):
- Python Version: 3.14
- Reflex Version: main (0.9.13.dev,
text_field.pyunchanged since 0.9.12) - OS: Linux
- Browser (Optional): any; checked with
react-dom19.2.8'srenderToStaticMarkup
Additional context
The stub shows str because _extract_class_props_as_ast_nodes in the pyi generator walks the MRO base-first and keeps the first declaration of each prop. A subclass's override of a prop's type or doc therefore never reaches the stub: TextFieldRoot's default_value and max_length also show elements.Input's types. That's a separate bug, so I'm keeping it out of the fix for this one.
- Ngôn ngữ chính
- Python
- Star
- 29k
- Fork
- 1.8k
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 181
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 reflex-dev/reflex
-
Add a `SetVar` backed by the JS `Set` objectCó thể đã có người làm @FarhanAliRaza đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
reflex-dev/reflex#7623 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
reflex-dev/reflex#7260 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reflex-dev/reflex#7148 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the defaultCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reflex-dev/reflex#6823 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
support redis v8Đang mởfeature request
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
reflex-dev/reflex#6764 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của reflex-dev/reflex
Issue tương tự
-
Project submission:Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
slavakurilyak/awesome-ai-agents#845 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdifficulty:2 enhancement good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
MakazhanAlpamys/Soup#2178 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
scverse/rapids-singlecell#854 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLCó thể đã có người làm @ninglinLiu đã nhận hôm nay. Đang mởarea:frontend backend:slang bug direction:input
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalseCó 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 85/100
Maintainer thường phản hồi trong vòng 13 ngày