Handing focus over to input field inside NodeView

I have a NodeView which renders an input field. The behavior I want to implement is this: if the current selection is a NodeSelection of a node of this particular type, and the user presses Enter, then the input field of that node should receive keyboard focus.

I’ve figured out the first half but got stuck trying to invoke .focus() inside the NodeView since I can’t see a way of getting from a node (or document range corresponding to a node) to its corresponding NodeView. I’ve thought of making an attribute like hasFocus and sending a node update with that attribute set to true but this seems brittle and not what attributes are probably meant for.

The following two threads come pretty close to answer my question.

Perhaps get the input from the dom element representing that node via the domAtPos since you’ll have the document position from the Selection (from/to) and just focus the input directly?

Yes, I think domAtPos and just finding the appropriate element from there would be the way to do this.