fix some duplicate code in text-kbd