Skip to content

Enable/Disable/Readonly Methods Ignore Silent Parameter #289

Closed

Description

@palcarazm

Error Description

The enable(), disable(), and readonly() methods ignore the silent parameter that other state-changing methods accept, causing them to always trigger change events even when silent mode is requested.

Steps to Reproduce

  1. Create a Bootstrap Toggle
  2. Call enable(true), disable(true), or readonly(true) with silent parameter set to true
  3. Observe that change events are still triggered

Expected Behavior

The enable(), disable(), and readonly() methods should respect the silent parameter and not trigger change events when silent is true.

Actual Behavior

These methods ignore the silent parameter and always trigger change events through the apply() method which defaults silent to false.

Severity

Moderate

Bootstrap 5 Toggle Version

5.3.0-rc1

Bootstrap version

5.3.8

Other

Analysis: The bug occurs because enable(), disable(), and readonly() methods call apply() without passing the silent parameter. In the Toggle class, these methods have fixed signatures without the silent parameter, while methods like on(), off(), toggle(), etc., accept it.

Correction: Add the silent parameter to the enable(), disable(), and readonly() method signatures and pass it to the apply() method:

enable(silent = false) {
    this.apply(ToggleActionType.ENABLE, silent);
}

disable(silent = false) {
    this.apply(ToggleActionType.DISABLE, silent);
}

readonly(silent = false) {
    this.apply(ToggleActionType.READONLY, silent);
}

Bug Report Checklist

  • Confirm that you agree to follow the project's code of conduct.
  • Confirm that you have reviewed open and rejected anomalies and have not found the reported anomaly.

Activity

  1. added this to the v5.3.0 milestone on Jan 24, 2026
  2. self-assigned this
    on Jan 24, 2026
  3. github-actions commented on Jan 24, 2026

    @github-actions

    Hi! 👋
    Thanks for your issue. You are helping to improve Bootstrap 5 toggle.

  4. added a commit that references this issue on Jan 24, 2026
    db349f4
  5. moved this from Needs triage to Closed in Issue triageon Jan 24, 2026
  6. added a commit that references this issue on Feb 22, 2026
    adddb35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions