eui icon indicating copy to clipboard operation
eui copied to clipboard

[EuiComboBox] Unable to properly highlight input text with mouse

Open wenchonglee opened this issue 4 years ago • 5 comments

Hey,

I recently noticed that if you were to mouse click and drag the text you just entered, you will be unable to overwrite that text by typing over it.

To be more specific:

  1. Type test
  2. Without clicking or pressing enter, drag text test
  3. Type abcd
  4. Notice test remains and no text can be overwritten

The codesandbox found in the "Custom options only, with validation" section can be used to replicate this problem.

You are able to overwrite the text if you used other means of highlighting the text, i.e. using crtl-a or double clicking the text

wenchonglee avatar Feb 19 '21 07:02 wenchonglee

Took a bit of fiddling to find a reliable reproduction:

  1. type test
  2. drag to highlight text, but start dragging in the containing div instead of the input (see below)
  3. text is highlighted, but typing does nothing

The problem is that the container div, with a tabindex={-1}:

Screen Shot 2021-02-19 at 10 00 56 AM

provides the look & feel of the input, while the actual input element:

Screen Shot 2021-02-19 at 10 01 37 AM

is much smaller. So the drag-to-highlight operation will, if the mouseup occurs outside the combobox area, select multiple DOM nodes instead of singularly the input's value. In the video below:

  • first attempt starts drag operation in the div and ending in the div (input remains just the size of the entered text) - can continue typing, but the text did not stay highlighted
  • second attempt starts dragging in the div but ends outside of it, text is highlighted but unable to change via typing

https://user-images.githubusercontent.com/313125/108537010-574b1300-729a-11eb-81b5-e9c19385233f.mov

And logging document.getSelection() in the "broken" state yields:

Screen Shot 2021-02-19 at 10 09 36 AM

Notice extentNode and focusNode are the proceeding h2 element, and type is Range. When only the text is selected, all of the values included are the selection are the input field, and the type is Caret.

Screen Shot 2021-02-19 at 10 11 23 AM

chandlerprall avatar Feb 19 '21 17:02 chandlerprall

I am working on this:) @chandlerprall @wenchonglee

anuragxxd avatar Feb 22 '21 18:02 anuragxxd

https://user-images.githubusercontent.com/58766532/109117389-f0c96780-7767-11eb-833e-60f2d02b07aa.mov

I am not able to replicate it @chandlerprall Any sugessions? (If this bug due to OS. I am using MacOS 10.15.3).

anuragxxd avatar Feb 25 '21 07:02 anuragxxd

Instead of clicking at the very beginning of the text,

Screen Shot 2021-02-25 at 2 09 56 PM

start in the extra white space to the left of the text and then drag outside of the combobox,

domselection

chandlerprall avatar Feb 25 '21 21:02 chandlerprall

@chandlerprall Please review this.

anuragxxd avatar Mar 02 '21 18:03 anuragxxd

👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.

github-actions[bot] avatar Sep 22 '25 00:09 github-actions[bot]