# utils/dom/isdomselectionbackward

module

<a id="functions">

## Functions

<a id="function-isDomSelectionBackward">

### `isDomSelectionBackward( selection ) → boolean`

Returns `true` if the given selection is backward, that is, if its `focus` is positioned before its `anchor`.

A replacement for reading `Selection#direction`, which is absent on older engines and reports `'none'` for a selection made with the mouse inside a shadow root. The orientation is then recovered from the anchor and focus positions instead, so an answer is always available.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-utils/src/dom/isdomselectionbackward.ts#L21)

#### Parameters

* `selection: Selection | ShadowSelection`

  The selection to check.

#### Returns

* `boolean`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
