This problem is caused by UIScreenEdgePanGestureRecognizer intercepting touches near screen edges. I found a complete solution:
The fix has three parts that must all be implemented together. Partial implementations will not fully resolve the issue.
here's the solution:
https://gist.github.com/hamdiqbal/f642e2d73d58e76f65a76dc10b44e725
Key insight: you must call setNeedsUpdateOfScreenEdgesDeferringSystemGestures() in BOTH viewDidLoad and viewWillAppear. Most solutions only call it once which is why they fail after view transitions.
Also critical: walk the full view hierarchy up to window level — system gesture recognizers are attached to parent views outside your keyboard's own view.
Tested and working on iPhone X, 12, 13, 14 and 15 series on iOS 16, 17 and 18.