Skip to content

[v3] Cannot hide a newly-created MenuItem #4077

@IanVS

Description

@IanVS

Description

If you create a menu item, then immediately hide it, it will not be hidden. Hiding in an event handler or click handler does however work.

To Reproduce

 myMenu := app.NewMenu()
 myMenu.Add("Hidden").SetHidden(true)
 systemTray.SetMenu(myMenu)

Image

Expected behaviour

The menu item should be hidden

Screenshots

No response

Attempted Fixes

No response

System Details

Wails (v3.0.0-dev)  Wails Doctor

# System

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 15.2                             |
| ID            | 24C101                           |
| Branding      | MacOS 15.2                       |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M2 Max                     |
| CPU 1         | Apple M2 Max                     |
| CPU 2         | Apple M2 Max                     |
| GPU           | 30 cores, Metal Support: Metal 3 |
| Memory        | 64 GB                            |
└──────────────────────────────────────────────────┘

# Build Environment

┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-dev                               |
| Go Version   | go1.23.5                                 |
| Revision     | 2c85b109aca5c9afe9a42fb0f26a3b9cfa235ec7 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOARM64      | v8.0                                     |
| GOOS         | darwin                                   |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | 2c85b109aca5c9afe9a42fb0f26a3b9cfa235ec7 |
| vcs.time     | 2025-02-09T05:57:06Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies

┌───────────────────────────┐
| npm             | 10.9.2  |
| *NSIS           | v3.10   |
| Xcode cli tools | 2409    |
└─ * - Optional Dependency ─┘

# Checking for issues

 SUCCESS  No issues found

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Additional context

https://discord.com/channels/1042734330029547630/1334926670070677555/1334926670070677555

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions