Skip to content

LabeledInput passes wrong attr names to SelectListMulti for toggle styles #269

@KJ7LNW

Description

@KJ7LNW

Bug Description

When using LabeledInput with type: 'selectMulti', the toggle button attrs (turnedOn/turnedOff styles) are not applied to the internal SelectListMulti widget.

Root Cause

In LabeledInput.prototype.initSelectMultiInput (LabeledInput.js), the attrs are passed with names like turnedOnBlurAttr:

this.input = new SelectListMulti( {
    // ...
    turnedOnBlurAttr: this.turnedOnBlurAttr ,
    turnedOnFocusAttr: this.turnedOnFocusAttr ,
    turnedOffBlurAttr: this.turnedOffBlurAttr ,
    turnedOffFocusAttr: this.turnedOffFocusAttr ,
    // ...
} ) ;

However, SelectListMulti (via BaseMenu) reads these attrs with the button prefix:

// BaseMenu.js lines 104-107
this.buttonTurnedOnBlurAttr = options.buttonTurnedOnBlurAttr || this.defaultOptions.buttonTurnedOnBlurAttr || { bgColor: 'cyan' } ;
this.buttonTurnedOnFocusAttr = options.buttonTurnedOnFocusAttr || this.defaultOptions.buttonTurnedOnFocusAttr || { bgColor: 'brightCyan' , color: 'gray' , bold: true } ;
this.buttonTurnedOffBlurAttr = options.buttonTurnedOffBlurAttr || this.defaultOptions.buttonTurnedOffBlurAttr || { bgColor: 'gray' , dim: true } ;
this.buttonTurnedOffFocusAttr = options.buttonTurnedOffFocusAttr || this.defaultOptions.buttonTurnedOffFocusAttr || { bgColor: 'white' , color: 'black' , bold: true } ;

Expected Behavior

Custom toggle attrs passed to LabeledInput should be applied to the dropdown items.

Suggested Fix

In LabeledInput.prototype.initSelectMultiInput, change:

turnedOnBlurAttr: this.turnedOnBlurAttr ,

to:

buttonTurnedOnBlurAttr: this.turnedOnBlurAttr ,

(and similarly for the other three toggle attrs)

Version

terminal-kit 3.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions