# DOM selection of block nodes

**URL:** https://discuss.prosemirror.net/t/dom-selection-of-block-nodes/2211
**Category:** Uncategorized
**Created:** [September 15, 2019, 11:26am UTC](https://discuss.prosemirror.net/t/dom-selection-of-block-nodes/2211 "2019-09-15T11:26:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![matej-svejda](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/matej-svejda/32/1103_2.png) [@matej-svejda](https://discuss.prosemirror.net/u/matej-svejda)
#### Post date: [September 15, 2019, 11:26am UTC](https://discuss.prosemirror.net/t/dom-selection-of-block-nodes/2211/1 "2019-09-15T11:26:36Z")

</div>

In my project I have some leaf block nodes that are children of the doc-node. Multiple of these can be directly below each other inside the doc. However if that is the case, using “normal text selection” (meaning by pressing and holding down the left mouse button and moving the cursor) you can only select none or all of the leaf block nodes directly adjacent to each other. The problem doesn’t happen when there are paragraphs (even if empty) between those nodes.

I made a minimal example of this here: [https://glitch.com/edit/#!/chain-cyclamen](https://glitch.com/edit/#!/chain-cyclamen) There you can see that selecting anything between pos 38 and 43 by the before mentioned “normal text selection” isnt possible.

Is there a way to make leaf block nodes behave nicely with normal text selection?

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)
#### Post date: [September 15, 2019, 7:02pm UTC](https://discuss.prosemirror.net/t/dom-selection-of-block-nodes/2211/2 "2019-09-15T19:02:52Z")

</div>

Text selection must start and end on inline positions. This reflects the way DOM selections work—you can’t put the cursor between blocks (and on some browser it even takes a kludge to programatically put a selection end there). So what you’re asking for can’t be done with text selections.

---

<div class="post-metadata">

### Author: ![matej-svejda](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/matej-svejda/32/1103_2.png) [@matej-svejda](https://discuss.prosemirror.net/u/matej-svejda)
#### Post date: [September 17, 2019, 2:04pm UTC](https://discuss.prosemirror.net/t/dom-selection-of-block-nodes/2211/3 "2019-09-17T14:04:16Z")

</div>

Ok I see. Thanks 🙂

---

<div class="post-metadata">

### Author: ![jiangpeng](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/jiangpeng/32/2828_2.png) [@jiangpeng](https://discuss.prosemirror.net/u/jiangpeng)
#### Post date: [June 30, 2022, 4:26am UTC](https://discuss.prosemirror.net/t/dom-selection-of-block-nodes/2211/4 "2022-06-30T04:26:18Z")

</div>

Hello, I also encountered the same problem. Have you solved this problem with other methods?
