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

Component: Dynamic Dialog's Autofocus on Close Button #13162

Closed
tranvanthinh300993 opened this issue Jun 8, 2023 · 2 comments · Fixed by #15263
Closed

Component: Dynamic Dialog's Autofocus on Close Button #13162

tranvanthinh300993 opened this issue Jun 8, 2023 · 2 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

@tranvanthinh300993
Copy link

Describe the bug

In previous versions, the dynamic dialog did not affect the initial autofocus. However, it focus to the Close button automatically

Environment

No specific environment.

Reproducer

No response

Angular version

16.0.3

PrimeNG version

v16.0.0-rc.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v18.16.0

Browser(s)

No response

Steps to reproduce the behavior

  1. Open a dialog with closable: true like this:
this.dialogService.open(ExampleDialogComponent, {
    header: 'Dialog header',
    closable: false
});
  1. View the result

Screenshot from 2023-06-08 09-03-39

Expected behavior

Should be 1 of these solutions:

  • Do not allow to autofocus the close button.
  • Add new property named isCloseButtonAutofocus or something like that to make sure that we can turn on/off the autofoccus for the close button.
@tranvanthinh300993 tranvanthinh300993 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 8, 2023
@tomer953
Copy link
Contributor

Yeah same here, latest primeng 16.3.1, we needed to autofocus an input, however only when added closable: false we managed to do so

@bvx5009
Copy link

bvx5009 commented Jan 30, 2024

ive encountered this problem as well and was able to go around it by using the AutoFocusModule in the custom header for my dynamic dialog.

<div class="flex flex-wrap h-full justify-content-between align-items-center" [autofocus]="true">
    <div class="flex align-items-center">
....
    </div>
    <p-button icon="fa-solid fa-xmark" [rounded]="true" [text]="true" [severity]="'secondary'"
        (onClick)="closeDialog()"></p-button>

</div>
this.dialogService.open(ReviewCommentsComponent, 
      { 
...
        templates: {
          header: ReviewCommentHeaderComponent,
        },
...
      },
      );
      

BGBRWR added a commit to BGBRWR/primeng that referenced this issue Apr 11, 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
@cetincakiroglu cetincakiroglu added this to the 17.14.0 milestone 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.

4 participants