# Creating a Mentions Function for Perspective text area/text field

**URL:** <https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977>\
**Category:** Ignition\
**Tags:** vision, perspective\
**Created:** [May 7, 2025, 1:31pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977 "2025-05-07T13:31:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [May 7, 2025, 1:31pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977/1 "2025-05-07T13:31:19Z")

</div>

> [@Creating a Mentions Function in within Comments Functionality (CMMS Project)](https://forum.inductiveautomation.com/t/creating-a-mentions-function-in-within-comments-functionality-cmms-project/96257/3):
>
> I don't imagine that a moving a list component around is the correct choice here, but it could probably be done effectively with a simple popup menu. Example: First, add a dataset custom property to the text area and populate it in some way, so it has a column called username. Then, use the following script on the text area's mousePressed event to generate the popup when the '@' key is pressed: if event.shiftDown and event.keyCode == event.VK\_2: from java.awt.event import MouseEvent user…

This discussion has a nice solution for @mention feature for vision, I'm now looking for something similar in Perspective—any way we can do that too?

---

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [May 9, 2025, 11:46am UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977/2 "2025-05-09T11:46:45Z")

</div>

I have found the nearest solution for this, But still if you see the popup with dropdown is not opening near the cursor, Instead it opens as usual popup opens in the center.

![@mention](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/ac91bc7e8b996a134dd9ea6bff376c3ed8ef7c33.gif)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 9, 2025, 12:48pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977/3 "2025-05-09T12:48:02Z")

</div>

You should try using a `contextMenu`. It exists on perspective components under `meta`.  
[Perspective Component Properties | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/perspective-component-properties#context-menu-item-types)

---

<div class="post-metadata">

**Author:** ![Hari\_GB](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hari\_GB](https://forum.inductiveautomation.com/u/Hari_GB)\
**Post date:** [May 10, 2025, 6:34am UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977/4 "2025-05-10T06:34:47Z")

</div>

I was looking for context menu, But it is like, I can able to open only on right kouse click of the component. I need something like in the image. To find a cursor and to the dropdown popup near the text area component cursor.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b18dc0736d3642f894f0818d543bde4f124eeafe.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 12, 2025, 6:18pm UTC](https://forum.inductiveautomation.com/t/creating-a-mentions-function-for-perspective-text-area-text-field/105977/5 "2025-05-12T18:18:04Z")

</div>

You can manually display/hide a context menu with `self.requestContextMenu()` and `self.removeContextMenu()`. There is still a problem since these methods do not include x,y params. It will always open from the component's center.

You can move it with a style transform, but I haven't found a way to do it consistently in the correct location since css units like `vh,vmax,vw, etc` reference the context menu itself, and not the text component. `transform: translateX(value)`

```python
	if event.shiftKey and event.key == '@':
		self.requestContextMenu()

```
