<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebEditingDelegate/webView(_:shouldChangeSelectedDOMRange:to:affinity:stillSelecting:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WebEditingDelegate(im)webView:shouldChangeSelectedDOMRange:toDOMRange:affinity:stillSelecting:"
  },
  "title" : "webView(_:shouldChangeSelectedDOMRange:to:affinity:stillSelecting:)"
}
-->

# webView(_:shouldChangeSelectedDOMRange:to:affinity:stillSelecting:)

Returns whether the user should be allowed to change the selected range.

```
optional func webView(_ webView: WebView!, shouldChangeSelectedDOMRange currentRange: DOMRange!, to proposedRange: DOMRange!, affinity selectionAffinity: NSSelectionAffinity, stillSelecting flag: Bool) -> Bool
```

## Parameters

`webView`

The web view that the user is editing.

`currentRange`

The old range the user wants to change.

`proposedRange`

The new range the user wants to select.

`selectionAffinity`

The direction of the selection.

`flag`

<doc://com.apple.documentation/documentation/Swift/true> if the user is still selecting; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the user is allowed to change the selected range; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## See Also

[`webViewDidChangeSelection(_:)`](/documentation/WebKit/WebEditingDelegate/webViewDidChangeSelection(_:))

Sent by the default notification center when the user changes the selection in the web view.



---

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)