Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoFocus for Dropdown: Does not work inside dialogComponent. #14010

Closed
ravikumar1243 opened this issue Nov 3, 2023 · 3 comments · Fixed by #15263
Closed

AutoFocus for Dropdown: Does not work inside dialogComponent. #14010

ravikumar1243 opened this issue Nov 3, 2023 · 3 comments · Fixed by #15263
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ravikumar1243
Copy link

Describe the bug

If AutoFocus is used for Dropdown inside a dialog, focus is not applied to the element.

For Text Box AutoFocus is working fine.
If Dropdown is not in dialog - AutoFocus is working fine.

Environment

Any Environment.

Reproducer

No response

Angular version

16.2.11

PrimeNG version

16.7.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

14.9.3

Browser(s)

Chrome 90

Steps to reproduce the behavior

  1. Add p-dropdown inside p-dialog
  2. Set [autofocus]=true to p-dropdown
  3. Focus is not on dropdown.

Expected behavior

Focus should be on p-dropdown

@ravikumar1243 ravikumar1243 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 3, 2023
@ravikumar1243 ravikumar1243 changed the title AutoFocus for Dropdown: Does not work inside dialogComponent: Title AutoFocus for Dropdown: Does not work inside dialogComponent. Nov 3, 2023
@cetincakiroglu cetincakiroglu removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 3, 2023
@cetincakiroglu
Copy link
Contributor

cetincakiroglu commented Nov 3, 2023

The autofocus is a Boolean attribute indicating that an element should be focused on page load. That's why it doesn't work with dialog. It's not a bug, you can find a workaround by timeout and focus manually on the dropdown when the dialog opens.

Closing the issue since it's not a bug or defect.

@ravikumar1243
Copy link
Author

The autofocus is a Boolean attribute indicating that an element should be focused on page load. That's why it doesn't work with dialog. It's not a bug, you can find a workaround by timeout and focus manually on the dropdown when the dialog opens.

Closing the issue since it's not a bug or defect.

Hi,

I tried all the ways including timeout and set the focus manually. It is not working.

As I explained before - autofocus is working fine for textbox inside p-dialog.

Here is the stackblitz url: https://stackblitz.com/edit/primeng-dialog-demo-14g5tl?file=src%2Fapp%2Fapp.component.html

Thanks in advance.

@ChristianCodeCamp
Copy link

Also doesn't work for us, it does work if you put in a random input with autofocus.

BGBRWR added a commit to BGBRWR/primeng that referenced this issue Apr 11, 2024
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 18, 2024
@cetincakiroglu cetincakiroglu added this to the 17.14.0 milestone Apr 18, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants