Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[p5.js 2.0+ Bug Report]: createRadio().disable(false) does not re-enable radio inputs

オープン 初心者向け
#9,316 コメント 4 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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 の本文から書いたものです。

説明

Area:DOM Good First Issue p5.js 2.0+
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
  1. Open the p5.js Web Editor and select p5.js 2.3.4.
  2. Replace the sketch with the code below and run it.
  3. Wait one second for radio.disable(false) to execute.
  4. 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

p5.js Web Editor reproduction showing radio buttons remaining disabled after calling disable(false)

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

processing/p5.js のほかの issue

processing/p5.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。