[p5.js 2.0+ Bug Report]: createRadio().disable(false) does not re-enable radio inputs
Maintainer thường phản hồi trong vòng 2 ngày
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
- 76/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ệ
- html, javascript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với self.disable trong src/dom/dom.js, nơi issue cho biết thuộc tính disabled được đặt trên từng radio input. Kiểm tra xem đã có bài kiểm thử nào bao phủ createRadio().disable() chưa và chạy các bài kiểm thử DOM liên quan. Công việc hoàn tất khi disable(false) xóa trạng thái bị vô hiệu hóa khỏi mọi radio input, còn disable(true) vẫn vô hiệu hóa chúng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- WebGPU
- p5.strands
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.3.4
Web browser and version
firefox 157.0
Operating system
fedora
Steps to reproduce
- Open the p5.js Web Editor and select p5.js 2.3.4.
- Replace the sketch with the code below and run it.
- Wait one second for
radio.disable(false)to execute. - Observe that the radio buttons remain disabled and the status text reports
Still disabled? true.
Expected behavior
Calling radio.disable(false) should re-enable the radio inputs, allowing the user to select an option again.
Actual behavior
The radio inputs remain disabled after radio.disable(false) is called.
The console shows that both inputs still have disabled === true, and their disabled attributes remain present with the string value "false".
Snippet
let radio;
let statusText;
function setup() {
createCanvas(400, 120);
radio = createRadio();
radio.option('red');
radio.option('blue');
radio.position(20, 40);
statusText = createP('Disabling radio buttons...');
statusText.position(20, 65);
radio.disable(true);
setTimeout(() => {
radio.disable(false);
const inputs = radio._getOptionsArray();
const stillDisabled = inputs.every(input => input.disabled);
statusText.html(
'Called disable(false). Still disabled? ' + stillDisabled
);
console.log(
'Disabled properties:',
inputs.map(input => input.disabled)
);
console.log(
'Disabled attributes:',
inputs.map(input => input.getAttribute('disabled'))
);
}, 1000);
}
function draw() {
background(240);
}
Screenshot
Additional context
The behavior appears to be caused by setting the HTML disabled attribute to a boolean value rather than updating the input's disabled state. HTML boolean attributes are enabled by their presence, regardless of the string value assigned to them.
The relevant implementation is in src/dom/dom.js, in self.disable, which iterates over the radio inputs and calls radioInput.setAttribute('disabled', shouldDisable).
A possible fix is to assign radioInput.disabled = shouldDisable, or otherwise remove the attribute when shouldDisable is false.
The reproduction was tested in the p5.js Web Editor using p5.js 2.3.4.
- Ngôn ngữ chính
- JavaScript
- Star
- 24.2k
- Fork
- 3.9k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
- 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 processing/p5.js
-
Area:Core p5.js 2.0+
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
processing/p5.js#9319 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Area:WebGL p5.js 2.0+ p5.strands
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
processing/p5.js#9317 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[p5.js 2.0+ Bug Report]: touches[0].x lags one pointer event behind while draggingCó thể làm lại được @titanstride đã nhận 8 ngày trước và không có pull request nào đang mở. Đang mởArea:Events p5.js 2.0+
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
processing/p5.js#9305 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
loadModel() options break without fileType and ignore flipU/flipVCó thể làm lại được @saniyaa-17 đã nhận 8 ngày trước và không có pull request nào đang mở. Đang mởArea:WebGL p5.js 2.0+
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
processing/p5.js#9302 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[p5.js 2.0+ Bug Report]: key docs needs updatingCó thể làm lại được @MannXo đã nhận 9 ngày trước và không có pull request nào đang mở. Đang mởHelp Wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
processing/p5.js#9296 · 6 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 processing/p5.js
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
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
vercel-labs/agent-skills#348 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NanmiCoder/dsh-agent-teams#289 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
c1overzz/dsh-bili-scroll#124 ·
Maintainer thường phản hồi trong vòng 1 ngày