Skip to content

TouchBarSegmentedControl - mutating segments leaves previous icon or label #17322

@MarcusNoble

Description

@MarcusNoble
  • Electron Version:
    • 4.0.9
  • Operating System:
    • macOS 10.13.6
  • Last Known Working Electron version::
    • N/A

Expected Behavior

When replacing the segments array of a TouchBarSegmentedControl I expect the control to be completely replaced with the new values specified.

Actual Behavior

When a TouchBarSegmentedControl is created with a control that just has an icon and the segments are replaced with one that just has a label both the initial icon and the new label are show. The same happens when going from label to icon.

To Reproduce

Repo example: https://github.com/MarcusNoble/electron-TouchBarSegmentedControl-bug/blob/42a5b8f0226b80a4900f21bc69d21cf25dcd4df7/main.js#L49-L67

$ git clone https://github.com/MarcusNoble/electron-TouchBarSegmentedControl-bug.git
$ npm install
$ npm start

Screenshots

  1. Start with a control that just has an icon:
    image

  2. Replace the control with one that just has a label. The icon remains (even if set to undefined or null):
    image

  3. Replace again with one that has a different icon. The label remains.
    image

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions