[p5.js 2.0+ Bug Report]: createRadio().disable(false) does not re-enable radio inputs
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 34
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信
processing/p5.js の issue をすべて見る
似ている issue
-
frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
uoftblueprint/canada-basketball#79 ·
メンテナーはふだん 1 日以内に返信
-
New App Request
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
ThatGuySam/doesitarm#1126 · コメント 1 件 ·
-
難易度 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 日以内に返信