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

rx.input(auto_complete=...): a bool is dropped by React, and a string raises a TypeError

Đã đóng Phù hợp với người mới
#7,417 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
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ệ
python, react
Lĩnh vực
frontend

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.py unchanged since 0.9.12)
  • OS: Linux
  • Browser (Optional): any; checked with react-dom 19.2.8's renderToStaticMarkup

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

Mở trong Codespaces

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.

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 reflex-dev/reflex

Tất cả issue của reflex-dev/reflex

Issue tương tự

Thêm issue về Python

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.