<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPanel/worksWhenModal",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPanel(py)worksWhenModal"
  },
  "title" : "worksWhenModal"
}
-->

# worksWhenModal

A Boolean value that indicates whether the panel receives keyboard and mouse events even when some other window is being run modally.

```
var worksWhenModal: Bool { get set }
```

## Discussion

The value of this property is <doc://com.apple.documentation/documentation/Swift/true> when the panel receives keyboard and mouse events even when some other window is being run modally; when the value is <doc://com.apple.documentation/documentation/Swift/false>, the panel is prevented from receiving events while a modal loop or session is running. By default, the value of this property is <doc://com.apple.documentation/documentation/Swift/false>, indicating a panel’s ineligibility for events during a modal loop or session. See [How Modal Windows Work](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Concepts/UsingModalWindows.html#//apple_ref/doc/uid/20000223) for more information on modal windows and panels.

## See Also

[`-  runModalSession:`](/documentation/AppKit/NSApplication/runModalSession(_:))

Runs a given modal session, as defined in a previous invocation of [`beginModalSession(for:)`](/documentation/AppKit/NSApplication/beginModalSession(for:)).

[`-  runModalForWindow:`](/documentation/AppKit/NSApplication/runModal(for:))

Starts a modal event loop for the specified window.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)