Sometimes I click to select a block and start typing in it and this black rectangle appears.

What is it and why does it appear randomly?
Thanks for asking about that. I wondered about it too!
The black rectangle is an old focus style for the selected state in an older editing mode that is no longer needed and will be removed in 3.7. It was fixed in #9186.
Most helpful comment
Thanks for asking about that. I wondered about it too!
The black rectangle is an old focus style for the selected state in an older editing mode that is no longer needed and will be removed in 3.7. It was fixed in #9186.