Updated fallback keyboard detection to @davelyon’s improved approach instead of traversing the view hierarchy