RadAutoComplete does not hold the cursor when Ctrl + A clicked

1 Answer 39 Views
AutoCompleteBox
Nisha
Top achievements
Rank 1
Nisha asked on 05 Sep 2024, 01:35 PM
We have one functionality that , we add search text in RadAutoComplete and on basis on entered text  "Treelist" refreshes data.But issue is when we put cursor in RadAutoComplete and click ctrl+A, it first time highlights the text from RadAutoComplete and when we second time press ctrl+A the cursor goes off and it selects entries from Treelist.So how can i handle ctrl+A for RadAutoComplete so that it hold the cursor and highlight the text.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 09 Sep 2024, 10:05 AM

Hi Nisha,

I was unable to reproduce the reported behavior on my end, even after several attempts. Could you please verify if the issue occurs in the live demos of the RadAutoCompleteBox, which run on the latest version of the control? This would help determine whether the issue is related to the control version or specific to your implementation.

In the meantime, you can try to mitigate the problem if the RadAutoCompleteBox is configured with InputType="Text". Here is a possible solution using a keyup event to capture Ctrl + A and ensure that the input remains selected without losing focus:

<script type="text/javascript">
            function OnClientLoad(sender, args) {
                var inputElement = sender.get_inputElement();
                inputElement.addEventListener('keyup', function (e) {
                if (e.ctrlKey && e.key === 'a') {
                        e.preventDefault();
                        inputElement.select();
                    }
                });
            }
        </script>
 <telerik:RadAutoCompleteBox InputType="Text" RenderMode="Lightweight" ID="RadAutoCompleteBox1" runat="server" OnClientLoad="OnClientLoad"... />

This script listens for the Ctrl + A combination and ensures the text inside the RadAutoCompleteBox is highlighted, preventing it from propagating and selecting other elements.

Let me know if this helps or if additional clarification is needed!

    Regards,
    Rumen
    Progress Telerik

    Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
    Tags
    AutoCompleteBox
    Asked by
    Nisha
    Top achievements
    Rank 1
    Answers by
    Rumen
    Telerik team
    Share this question
    or