ember-basic-dropdown icon indicating copy to clipboard operation
ember-basic-dropdown copied to clipboard

<Input /> element inside trigger gets focused unintentionally on mobile devices

Open raido opened this issue 4 years ago • 2 comments
trafficstars

https://github.com/cibernox/ember-basic-dropdown/blob/4596ed5475c47f90038dad44dd11c0dac6e34d12/addon/components/basic-dropdown-trigger.ts#L112

Here we handle target.focus() call, so if we have following template:

<dd.Trigger>
  <input type="text" />
</dd.Trigger>

It will always forcefully focus the element when user happens to start scroll on mobile having touch point on the trigger/input element.

raido avatar Jun 11 '21 12:06 raido

That was kind of intentional, so users can start typing (and filtering) the options immediately. What improvement do you suggest? Make the focus in optional?

cibernox avatar Jun 11 '21 12:06 cibernox

Could we wrap target.focus() with "hasMoved()" check as well, so there is certain threshold before focus() is called?

In my app with current implementation if I want to quickly scroll to bottom of my "view" and I happen to hit trigger element, then it is impossible to scroll down because input gets focused and browser viewport is scrolled back to element at hand.

raido avatar Jun 11 '21 12:06 raido