flutter_typeahead icon indicating copy to clipboard operation
flutter_typeahead copied to clipboard

Desktop - Arrow keys support

Open selvam920 opened this issue 3 years ago • 2 comments

Is there any possible to select dropdown item by keyboard arrow down or up keys

selvam920 avatar Mar 27 '21 06:03 selvam920

This hasn't been -- well -- anything for Desktop support -- however, I would think arrow key support would be built into the main Desktop logic (i.e. Flutter) and not have to be dealt with in all I/O packages .. You sure there isn't something else you need to do for this in the main logic?

sjmcdowall avatar Mar 28 '21 21:03 sjmcdowall

The built-in Autocomplete supports arrow keys now: https://github.com/flutter/flutter/issues/82783

Sunbreak avatar Aug 22 '21 15:08 Sunbreak

How about preventing keyboard up and down keys from having any effect to begin with ?

On the first touch of down key the textField below is highlighted, as a result users are confused into thinking this is a viable way to navigate through suggestions, but since next touch does nothing they try again, fail and open a bug report.

Removing up/down key events avoid misleading users who can live with scrolling or typing one extra letter.

I opened the PR https://github.com/AbdulRahmanAlHamali/flutter_typeahead/pull/435 with edits below,

KeyEventResult _onKeyEvent(FocusNode _, RawKeyEvent event) {
    if (event.isKeyPressed(LogicalKeyboardKey.arrowUp) ||
        event.isKeyPressed(LogicalKeyboardKey.arrowDown)) {
        // do nothing to avoid puzzling users until keyboard arrow nav is implemented
    } else {
      _keyboardSuggestionSelectionNotifier.onKeyboardEvent(event);
    }
    return KeyEventResult.ignored;
  }

flutter-painter avatar Nov 09 '22 00:11 flutter-painter