How to attempt to detect pressed key in filterTransaction?

Is there any approach to allowing only spacebar/enter-initiated events to fire in filterTransaction? I’m trying to make some certain text effectively non-editable but I still need to allow space/enter and I can’t find any reasonable approach.

Not directly. Transactions don’t have a direct association with keypresses. But you could bind custom commands to spad and enter and set a metadata flag on them, and then check that flag in your filter.