Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

In Text Field with one line, "Enter" on physical keyboard should validate the action

Open Arthur-Milchior opened this issue 1 year ago • 5 comments

I'll first give you the example that I currently care about, while I test AnkiDroid in the emulator, then the general request.

# Examples

Create Deck

How to reproduce:

  • open ankidroid
  • tap on plus > Create deck
  • on a physical keyboard, type "foo" and press enter

Expected result:

  • The new deck is created

Actual result:

  • The focus goes on the cancel button

Automatic backup

  • Open the settings
  • backup
  • minutes between automatic backups
  • tap 31, enter

Expected

  • you'll see the number 31, and validated

Actual:

  • all keyboard interaction are ignored

General case

More generally, we should look at all text field/text input that has either:

  • IncrementNumberRangePreferenceCompat
  • any TextInputEditTExt with android:maxLines="1". That is, dialog_tts_voices dialog_tts_voices_voice and dialog_generic_text_input.xml (I admit I don't know TTS and don't know which dialog it corresponds to)

Note to contributors

If you want to be assigned this issue, please don't hesitate to tell us that you'll only work on one single part of the issue. There seems to be a dozen of part of the code to correct. I don't know how many part can be corrected at once, and how many requires distinct code change. Also, don't hesitate to do small commits/PR, that solve only one part of the problem, so that we can iterate quickly

Arthur-Milchior avatar Aug 15 '24 12:08 Arthur-Milchior

any TextInputEditTExt with android:maxLines="1". That is, dialog_tts_voices dialog_tts_voices_voice and dialog_generic_text_input.xml (I admit I don't know TTS and don't know which dialog it corresponds to)

A dialog accessible via {{tts-voices:}} in the card template

david-allison avatar Aug 15 '24 21:08 david-allison

@Arthur-Milchior hey I was the one who edited the "create deck" text field(#16704) few weeks ago maybe I should look into it

MinusMallard avatar Aug 21 '24 11:08 MinusMallard

Thanks @MinusMallard

Arthur-Milchior avatar Aug 21 '24 12:08 Arthur-Milchior

@Arthur-Milchior I have done some edits pressing "enter" directly presses on screen ok button and pressing "tab" button on keyboard changes focus to the on screen ok button( earlier pressing "tab" button on physical keyboard was changing focus to cancel) reference: https://developer.android.com/develop/ui/views/touch-and-input/keyboard-input/navigation

https://github.com/user-attachments/assets/983d91d1-77b0-4823-86dc-b0d4364924ed

MinusMallard avatar Aug 22 '24 09:08 MinusMallard

I think that tab should move to "cancel", this is what seems to be the natural order according to screen. And if "enter" validates the input, there seems to be no need to make another fast way to do okay

Arthur-Milchior avatar Aug 23 '24 14:08 Arthur-Milchior

Issue resolved

sanjaysargam avatar Sep 28 '24 17:09 sanjaysargam