In Chrome, The getSelectedElement() function returns a [body] tag when an [input type='number'] is selected
Create a page with a basic Rad Editor, with HTML mode enabled
Go into HTML Mode, add at least the following: <input type="number" />
Go back to Design Mode
Click on the numeric input
To See the Problem:
In the console of the Browser's Developer Tools, get a reference to the Rad Editor
Call its getSelectedElement() function
In Chrome, the returned element will be a <body> tag (NOT GOOD)
In Firefox, it will be an apparently random (maybe the first?) user-selectable element within the HTML (NOT GOOD)
In IE11, it will be the numeric input (DESIRED)
In Edge, it will be a <body> tag (NOT GOOD)
Posted on:31 Jan 2019 12:35
Thank you for reporting this issue! It is much appreciated!
I converted the support ticket to a public feedback portal item of type Bug Report so that more users learn about it and see the solution below. You can access the public item from here.
I compared the browser's iframe.contentWindow.document.activeElement setting with the RadEditor's editor.getSelectedElement() and found that the number type should be added to the isTextElement internal method so that getSelectedElement should start to work properly with this input type. The same is true for the range, date, datetime-local, month, time and week.
I logged the problem and we will fix it for R2 2019. Until than you can use the function override below highlighted in orange:
The solution works for Chrome, IE and Edge. In Firefox many of the inputs are disabled and the browser's document.getElementById('RadEditor1_contentIframe').contentWindow.document.activeElement property returns incorrect elements when selecting input elements.
As a small note of gratitude for your bug report, I updated your Telerik points.
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.