[p5.js 2.0+ Bug Report]: createRadio().disable(false) does not re-enable radio inputs
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- html, javascript
- 领域
- frontend
调研方向
从 src/dom/dom.js 中的 self.disable 开始,issue 指出它会为每个单选输入设置 disabled 属性。检查是否已有覆盖 createRadio().disable() 的测试,并运行相关的 DOM 测试。当 disable(false) 移除每个单选输入的禁用状态,同时 disable(true) 仍会禁用它们时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 24.2k
- 派生
- 3.9k
- 平均合并
- 3 天 3 小时
- 30 天内合并 PR
- 34
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
processing/p5.js 的其他 Issue
-
[p5.js 2.0+ Bug Report]: p5.js fails to load when localStorage is blocked (regression in 2.4.0-rc.1)未关闭Area:Core Internationalization
难度 2/5 1-3 小时 新手友好度 78/100
processing/p5.js#9323 ·
维护者通常 3 天内回复
-
Area:Core p5.js 2.0+
难度 2/5 1-3 小时 新手友好度 66/100
processing/p5.js#9319 · 1 条评论 ·
维护者通常 3 天内回复
-
Area:WebGL p5.js 2.0+ p5.strands
难度 2/5 1-3 小时 新手友好度 68/100
processing/p5.js#9317 · 4 条评论 ·
维护者通常 3 天内回复
-
[p5.js 2.0+ Bug Report]: touches[0].x lags one pointer event behind while dragging可能已有人在做 @titanstride 于 6 天前认领。 未关闭Area:Events p5.js 2.0+
难度 2/5 1-3 小时 新手友好度 76/100
processing/p5.js#9305 · 1 条评论 ·
维护者通常 3 天内回复
-
loadModel() options break without fileType and ignore flipU/flipV可能已有人在做 @saniyaa-17 于 6 天前认领。 未关闭Area:WebGL p5.js 2.0+
难度 2/5 1-3 小时 新手友好度 78/100
processing/p5.js#9302 · 2 条评论 ·
维护者通常 3 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
lyswhut/lx-music-desktop#3026 ·
-
good first issue server
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
openstreetmap/iD#13054 ·
维护者通常 1 天内回复
-
community marketing priority: low
难度 2/5 1-3 小时 新手友好度 72/100
TMHSDigital/Free-Game-Dev-Assets#151 ·
维护者通常 1 天内回复
-
Read a vector index's quantization back on Neo4j 2026.10, which reports vector.quantization.type未关闭
难度 2/5 1-3 小时 新手友好度 78/100
liberation-data/drivine#231 ·
维护者通常 1 天内回复