---
title: "webView(_:shouldChangeSelectedDOMRange:to:affinity:stillSelecting:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webeditingdelegate/webview(_:shouldchangeselecteddomrange:to:affinity:stillselecting:)"
---

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

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

## Declaration

```swift
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

Return Value true if the user is allowed to change the selected range; otherwise, false.

## See Also

### Related Documentation

- [webViewDidChangeSelection(_:)](webkit/webeditingdelegate/webviewdidchangeselection(_:).md)
