Hi,
While using the lib i encountered an issue with the open() method.
When calling mentionsComp.open() programmatically (for example, via a button click to insert @ at the cursor position), the @ is inserted into the textarea, and the mentions list opens correctly. However, as soon as I type any character after the @, the library removes the @ automatically (the online demo have the same issue).
It seems that the library only considers a mention started when the user physically types the triggerChar, and open() does not mark the mention as “active” internally. Because of this, programmatically inserting @ and opening the mentions list does not work correctly.
Expected behavior:
- Calling
open() should insert @ and keep it in the textarea.
- The mention list should stay open and accept typed characters after the inserted
@.
Current behavior:
@ appears when open() is called.
- The
@ disappears immediately when typing the next character or selecting a item.
Steps to reproduce:
- Add a button that calls
mentionsComp.open().
- Click the button to insert
@.
- Type a character after the
@ or select a item.
- Observe that the
@ disappears.
Environment:
- ng-mentions version: latest version
- Angular version: 17
Possible solution:
- Allow
open() to accept a parameter marking the mention as active, so that the library does not remove the inserted @.
Thank you!
Hi,
While using the lib i encountered an issue with the
open()method.When calling
mentionsComp.open()programmatically (for example, via a button click to insert@at the cursor position), the@is inserted into the textarea, and the mentions list opens correctly. However, as soon as I type any character after the@, the library removes the@automatically (the online demo have the same issue).It seems that the library only considers a mention started when the user physically types the
triggerChar, andopen()does not mark the mention as “active” internally. Because of this, programmatically inserting@and opening the mentions list does not work correctly.Expected behavior:
open()should insert@and keep it in the textarea.@.Current behavior:
@appears whenopen()is called.@disappears immediately when typing the next character or selecting a item.Steps to reproduce:
mentionsComp.open().@.@or select a item.@disappears.Environment:
Possible solution:
open()to accept a parameter marking the mention as active, so that the library does not remove the inserted@.Thank you!