Skip to content

TabContainer selects first tab (0) when current_tab == -1 and does not persist value of -1 #108223

@thygrrr

Description

@thygrrr

Tested versions

  • reproducible in 4.5-beta1

System information

Win11, Godot 4.5 beta

Issue description

A tab container configured to allow deselection of all tabs, and in conflict with the help text, starts with the first tab selected, rather than no tab selected, if current_tab is set to -1.

The in-editor representation works as expected once, but not across editor restarts.

I suspect this is a problem in serializing the value, reloading the editor will result in the value being set to 0 instead of -1.

Image

Steps to reproduce

  1. Open MRP.
  2. observe: first tab is selected (should be not selected)
  3. observe: current_tab is 0 (and shows "rever to default" arrow)
  4. set current tab to -1
  5. observe: all tabs deselected
  6. run MRP.
  7. observe: first tab is selected
  8. repeat step 4
  9. save and close scene or quit editor
  10. reopen scene or project
  11. observe 2 & 3 again

Expected output: (editor state analogous)
Image

Actual output:
Image

Minimal reproduction project (MRP)

MRP-tabcontainer.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions