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

aria-invalid is not supported on handles

Đang mở Phù hợp với người mới
#1,097 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
90/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
accessibility, frontend

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi xem Slider chuyển tiếp các thuộc tính hỗ trợ truy cập đến các nút trượt như thế nào, đặc biệt là cách xử lý ariaRequired hiện có và ariaDescribedByForHandle dành riêng cho nút trượt. Thêm thuộc tính booleanh ariaInvalid để hiển thị aria-invalid trên từng nút trượt. Hoàn tất nghĩa là thuộc tính này đã đến với mọi nút trượt và kiểu, hành vi cũng như khả năng kiểm thử hỗ trợ truy cập mong đợi đều đã được xác minh.

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

Mô tả

A handle (role="slider") can be given aria-label, aria-labelledby, aria-describedby (#1088), aria-required and aria-valuetext, but not aria-invalid. WAI-ARIA 1.2 supports aria-invalid on the slider role, and it is how a screen reader learns that a field's value failed validation. Without it, a form can show a slider's error only visually.

Slider drops the aria-* props it is given, and the handle takes nothing beyond its own props, so the only way to set it is to change the DOM after render, the workaround #1040 described for aria-describedby.

antd shows the gap. Form.Item passes aria-invalid, aria-describedby and aria-required to its child control. An Input gets all three, but Slider drops them (antd 6.6.6, @rc-component/slider 1.1.1):

<Form fields={[{ name: ['name'], errors: ['Too short'] }, { name: ['volume'], errors: ['Too quiet'] }]}>
  <Form.Item name="name" label="Name" required extra="Your name">
    <Input />
  </Form.Item>
  <Form.Item name="volume" label="Volume" required extra="How loud">
    <Slider />
  </Form.Item>
</Form>

renders, with class and style left out:

<input id="name" aria-describedby="name_help name_extra" aria-required="true" type="text" value="" aria-invalid="true">

<div tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-disabled="false"
  aria-orientation="horizontal"></div>

Could the slider take an ariaInvalid?: boolean prop alongside ariaRequired, rendered as aria-invalid on each handle? antd could then pass it through as it did ariaDescribedByForHandle (ant-design/ant-design#59110), and its Slider could give the handle the aria-invalid, aria-describedby and aria-required that Form.Item hands it.

We hit this in react-jsonschema-form's antd theme, which can't mark its slider invalid: rjsf-team/react-jsonschema-form#5560.

Ngôn ngữ chính
TypeScript
Star
3.1k
Fork
766
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 react-component/slider

Tất cả issue của react-component/slider

Issue tương tự

Thêm issue về TypeScript

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.