primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.44k stars 4.6k forks source link

Dropdown with filter property should be open when focus event is on field #3573

Closed Zuiago closed 7 years ago

Zuiago commented 7 years ago

[ ] bug report [x ] feature request [ ] support request

Current behavior Dropdown with filter property, today if you focus is on field it needs a click to allow digitation

Expected behavior Dropdown component should open when focus is on field. This provide faster search using the filter property.

Minimal reproduction of the problem with instructions You can face the issue on offical PG page https://www.primefaces.org/primeng/#/dropdown

What is the motivation / use case for changing the behavior? To make accessibility more easy for users that use "Tab" button for navigation in the page.

Please tell us about your environment:

Zuiago commented 7 years ago

Maybe can i use yours autocomplete component. Now i can see it. But is a interesting feature for dropdown component. Thank's!

cagataycivici commented 7 years ago

You can use alt + down as well to open it.

maplion commented 6 years ago

@cagataycivici Was there/will there be any attempt to change this behavior to the suggested (i.e. make it so when you tab into the dropdown it automatically opens the dropdown and puts the cursor in the filter)?

vascorebolo commented 6 years ago

From an accessibility point of view, it would make a lot of sense if when opening the dropdown with alt + down, the filter would be focused. I was testing this and I was unable to figure out how to go to the filter input using only the keyboard. Is there a way to do it?

maplion commented 6 years ago

@vascocsilva Not that I know of; the best I could do was use the arrow keys to get to things in the list (which in a long list is not convenient at all -- and usually filtered dropdowns are long lists). From a standard user point-of-view, they aren't going to alt + anything. For simple usability, it would make sense that on focus it automatically opens the dropdown and sticks your cursor in the filter list as the priority should be the filter list and not the dropdown (otherwise people would use the regular dropdown component). I'm really surprised more people don't have an issue with this.

maplion commented 6 years ago

@cagataycivici Is there a reason this was closed? I really think this should be reopened as it is not an existing feature and this thread was not resolved.

pedromrb commented 6 years ago

Agree, if building something and using this component and the requirements include accessibility this should be resolved.

mstruchen commented 6 years ago

Having this automatically open when you tab into the dropdown would be a hug improvement for the user experience. Please reopen and resolve.

kc13greiner commented 5 years ago

@cagataycivici Please implement this feature. Spacebar and Alt + (downarrow) get to the dropdown items, but what about the filter?

CheckMater commented 5 years ago

You can also try something like this:

<p-dropdown #theDropdown (onFocus)="onDropDownFocus(theDropdown)" [options]="theoptions" [filter]="true"></p-dropdown>

In your component:

onDropDownFocus(dropdown) {
  if (!dropdown.selfClick) {
    dropdown.show();
  }
}

Tested with version 8+ and it works properly.

fabiocurtisvolpe commented 1 year ago

Do it as follows

@ViewChild("dp") dp: Dropdown;

ngAfterContentInit(): void { setTimeout(() => { this.dp.show(); }, 100); }

Using onDropDownFocus for some reason is not allowing to reopen the dropdown

JaredScar commented 1 year ago

You can also try something like this:

<p-dropdown #theDropdown (onFocus)="onDropDownFocus(theDropdown)" [options]="theoptions" [filter]="true"></p-dropdown>

In your component:

onDropDownFocus(dropdown) {
  if (!dropdown.selfClick) {
    dropdown.show();
  }
}

Tested with version 8+ and it works properly.

Was this essentially pseudocode? I cannot see a selfClick variable attached to the p-dropdown element. Using version 9 of primeng. Thanks