Move cursor to child node

At this moment, I create a MenuItem that produces a ul and a li as a child. See below:

 run (state, dispatch) {
        const li = schema.nodes.li.create()
        const ul = schema.nodes.ul.create(null, li)
        dispatch(state.tr.replaceSelectionWith(ul))   
}

This code works great. But: how can I place the cursor directly after the child node (li)? After adding an ‘ul/li’ node, the cursor is placed after the ‘ul’… How can I fix this?

(If your schema is anything like the example schemas, empty li nodes aren’t allowed, so you should do something like schema.nodes.li.createAndFill() to create a valid one.)

The cursor can only be placed in positions that allow text content, so you can’t put it directly after a list item node.