ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

[Feature Request]:Exposing event when texts are selected in Input/TextArea/Label/Text

Open bennylalala opened this issue 1 year ago • 7 comments

Feature Request Description

Hi Team

We are working on a feature. It requires listening on sort of event when texts are selected in Input/TextArea/Label/Text. Please refer to the screen. When user selects the texts in the text area, we would show some widget next to the selected texts. image

Proposed Solution

We might have way to listen on select or mouseup event and use window.getSelection(), but that relies on the internal input, textarea or text element wrapped by the component. Ideally, the component can expose one event when texts are selected by mouse or keyboard. The event data could be the selected texts and coordinates.

Proposed Alternatives

No response

Organization

SAP Successfactors

Additional Context

No response

Priority

Medium

Privacy Policy

  • [X] I’m not disclosing any internal or sensitive information.

bennylalala avatar Nov 09 '23 15:11 bennylalala

Hello colleagues,

Can you have a look at this feature request? It's for several controls but the Text Area and Input are on your side, that's why I am sending it to you. Can you please evaluate if this is something that we can provide and if it is a good fit for the controls?

Best Regards, Tsanislav

tsanislavgatev avatar Nov 10 '23 08:11 tsanislavgatev

Internal BLI crested: FIORITECHP1-29316

hristop avatar Dec 11 '23 07:12 hristop

Dear reporter,

we started working on the feature request. In order to prevent exposing APIs that might be handy to your side we have the following proposal:

  • we merge #8340 where you will get the select and scroll event exposed on the textarea API
  • we will then provide you an util (js module as a snippet) which will enable you to get selection info (coordinates, text, etc)
  • you can then play around with it and give us some feedback regarding API, what can be improved or completely changed

Once we agree on a stable and suitable API for the use case we will move the util to our code and it will become a blackbox for you.

Would that be okay for you?

Best Regards! Martin

MapTo0 avatar Feb 23 '24 09:02 MapTo0

Hi @bennylalala ,

Would you agree with the proposed workflow?

Best Regards, Hristo

hristop avatar Mar 26 '24 14:03 hristop

Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!

github-actions[bot] avatar Apr 17 '24 00:04 github-actions[bot]

@hristop It works by listening on the select event. And we have our util to get the coordinates by using Selection API. So we are good with this solution.

I see only TextArea exposes this event right now... Input needs to expose the same.

Other than TextArea/Input, we need similar stuff for readonly text or label. They do not have select event, but we figured it out by using Selection API in our util as well.

BennyHuang avatar Apr 22 '24 21:04 BennyHuang

Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!

github-actions[bot] avatar May 14 '24 00:05 github-actions[bot]