Skip to content

Switch from Enter to TAB for mentions autocomplete with tribute #16735

Closed
@brunob

Description

@brunob

Hi, since #3136 we have nice autocomplete of mentions powered by tribute.js but we miss the native behavior or tribute (and major part of autocomplete systems) when we have to validate an item by pressing ENTER key instead of TAB one.

I've tested it on tribute demo page https://zurb.github.io/tribute/example/ and TAB works well for selecting an item in the autocomplete dropdown. I've also tested on a gitea issue page after disabling SimpleMDE (ref #10099) and it works well with TAB key.

I found that the TAB key is catched by SimpleMDE/CodeMirror and that the ENTER key behavior is handled here https://github.com/go-gitea/gitea/blob/main/web_src/js/index.js#L1751

FTR, the CodeMirror author says that this tab focus/catching is a bad choice :

At some point, I let people convince me that the editor should override tab by default. I think that was a bad call, now, but won't be able to change it until the next major release.

codemirror/codemirror5#5444

What do you think of switching from ENTER to TAB key in https://github.com/go-gitea/gitea/blob/main/web_src/js/index.js#L1751 as we can get mentions working like any other platform ?

PS : this also can be done with a specific class on text fields cf codemirror/codemirror5#5444

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/uiChange the appearance of the Gitea UI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions