Contact emailsExplainerSpecificationNone
SummaryImplements retrieval of selection bounds within <textarea> and <input> elements of type text, email, number, password, search, tel, or url. The bounding rectangle is the caret rectangle if the selection is collapsed. If there is no selection in the <textarea> or <input>, it will return an empty rectangle.
Blink componentMotivationWhile getBoundingClientRect() can already be used to obtain selection bounds in content-editable <div> elements, no equivalent exists for standard form input elements. As a result, developers must resort to workarounds involving <div> elements to simulate input behavior, which is both inefficient and unnecessarily complex. This is due to the fact that, unlike <textarea> and <input>, the <div> element isn’t designed for user input—it lacks built-in accessibility, native form behavior, and requires additional JavaScript to simulate basic input functionality. By contrast, getSelectionBoundingClientRect() provides a simpler and more intuitive solution for web developers. It allows them to work directly with standard form elements without needing to reimplement input behavior or manage accessibility concerns manually. This makes it a more robust and developer-friendly alternative for handling selection bounds in web applications.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/MW2PR2101MB09222727A956427F09B985AC8070A%40MW2PR2101MB0922.namprd21.prod.outlook.com.
You don't often get email from sche...@chromium.org.
Learn why this is important
|