Skip to content

[p5.js 2.0+ Bug Report]: createRadio().remove() does not remove the radio element #9146

Description

@slash-init

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.1

Web browser and version

firefox 155.0

Operating system

linux fedora

Steps to reproduce this

Steps:

  1. Create a radio using createRadio().
  2. Add a couple of options.
  3. Call radio.remove().

Snippet:

let radio;

function setup() {
  createCanvas(400, 400);

  radio = createRadio();
  radio.option('Option 1');
  radio.option('Option 2');
  radio.position(20, 20);
}

function mousePressed() {
  radio.remove();
}

Expected behavior:

Calling radio.remove() should remove the radio element from the page, like remove() does for other p5.Elements.

Actual behavior:

The radio stays on the page and isn't removed.
I noticed that createRadio() has its own remove(value) method for removing individual options. This seems to shadow the remove() inherited from p5.Element.
So radio.remove('Option 1') works as expected, but calling radio.remove() without an argument doesn't remove the radio element.
The same thing also seems to happen with removeElements(), where the radio element is left behind.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions