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

Closed
opened 2025-11-02 07:34:29 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @brunob on GitHub (Aug 19, 2021).

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 https://github.com/go-gitea/gitea/pull/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.

https://github.com/codemirror/CodeMirror/issues/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 https://github.com/codemirror/CodeMirror/issues/5444

Originally created by @brunob on GitHub (Aug 19, 2021). 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 https://github.com/go-gitea/gitea/pull/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. https://github.com/codemirror/CodeMirror/issues/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 https://github.com/codemirror/CodeMirror/issues/5444
GiteaMirror added the topic/ui label 2025-11-02 07:34:29 -06:00
Author
Owner

@nmrugg commented on GitHub (Oct 19, 2021):

This would be great. It's disorienting that tab does not work.

@nmrugg commented on GitHub (Oct 19, 2021): This would be great. It's disorienting that `tab` does not work.
Author
Owner

@brunob commented on GitHub (Oct 20, 2021):

Do you want/need a PR for that ?

@brunob commented on GitHub (Oct 20, 2021): Do you want/need a PR for that ?
Author
Owner

@wxiaoguang commented on GitHub (Apr 26, 2023):

The tribute popup has been refactored.

@wxiaoguang commented on GitHub (Apr 26, 2023): The tribute popup has been refactored.
Author
Owner

@brunob commented on GitHub (Apr 26, 2023):

@wxiaoguang what do you mean by tribute popup ? Do you have any reference to provide ?

@brunob commented on GitHub (Apr 26, 2023): @wxiaoguang what do you mean by tribute popup ? Do you have any reference to provide ?
Author
Owner

@wxiaoguang commented on GitHub (Apr 26, 2023):

try.gitea.io

Replace tribute with text-expander-element for textarea #23985

@wxiaoguang commented on GitHub (Apr 26, 2023): try.gitea.io Replace tribute with text-expander-element for textarea #23985
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7718