---
title: allowsWindowActivationEvents()
framework: swiftui
role: symbol
role_heading: Instance Method
path: swiftui/view/allowswindowactivationevents()
---

# allowsWindowActivationEvents()

Configures gestures in this view hierarchy to handle events that activate the containing window.

## Declaration

```swift
nonisolated func allowsWindowActivationEvents() -> some View

```

## Discussion

Discussion Views higher in the hierarchy can override the value you set on this view. In the following example, the tap gesture on the Rectangle won’t handle events that activate the containing window because the outer allowsWindowActivationEvents(_:) view modifier overrides the inner one: HStack {     Rectangle()         .onTapGesture { ... }         .allowsWindowActivationEvents() } .allowsWindowActivationEvents(false) note: It’s only possible to disallow handling events that activate the containing window for views that allow it by default or that inherit this behavior from their ancestors. Views that explicitly already disallow this functionality can’t have it turned on.

## See Also

### Managing window behavior

- [WindowManagerRole](swiftui/windowmanagerrole.md)
- [windowManagerRole(_:)](swiftui/scene/windowmanagerrole(_:).md)
- [WindowInteractionBehavior](swiftui/windowinteractionbehavior.md)
- [windowDismissBehavior(_:)](swiftui/view/windowdismissbehavior(_:).md)
- [windowFullScreenBehavior(_:)](swiftui/view/windowfullscreenbehavior(_:).md)
- [windowMinimizeBehavior(_:)](swiftui/view/windowminimizebehavior(_:).md)
- [windowResizeBehavior(_:)](swiftui/view/windowresizebehavior(_:).md)
- [windowBackgroundDragBehavior(_:)](swiftui/scene/windowbackgrounddragbehavior(_:).md)
- [allowsWindowActivationEvents(_:)](swiftui/view/allowswindowactivationevents(_:).md)
