Find a better keyboard. That only happens on the default AOSP keyboard with by now it's a 10-year old codebase with little maintenance.