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

ConfirmDialog/ConfirmPopup: Add defaultFocus option like PrimeVue #4051

Closed
KOliver94 opened this issue Feb 14, 2023 · 1 comment · Fixed by #5401 or #5703
Closed

ConfirmDialog/ConfirmPopup: Add defaultFocus option like PrimeVue #4051

KOliver94 opened this issue Feb 14, 2023 · 1 comment · Fixed by #5401 or #5703
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@KOliver94
Copy link
Contributor

Describe the feature you would like to see added

The basic confirmDialog is a perfect solution for getting the user's confirmation before execution. However, in some cases I would like to not have the accept button highlighted for example on a delete confirmation. For a delete I would like to have the reject selected as default to avoid accidential consequences of keyboard button pressing.

Is your feature request related to a problem?

Right now I can swap the accept and reject buttons but it's logically not right and the places also swap. Another way is to create my own footer but this way the component lose its ease of use and I mostly need to copy the original implementation and set the autoFocus on the other button.

Describe the solution you'd like

It would be great if we could have a focusReject boolean prop for Confirm Dialog which is false by default. If the user sets it to true the reject button would be auto focused instead of the accept one.

I would change this part:

<Button label={rejectLabel} icon={getPropValue('rejectIcon')} className={rejectClassName} onClick={reject} />
<Button label={acceptLabel} icon={getPropValue('acceptIcon')} className={acceptClassName} onClick={accept} autoFocus />

to something like that:

<Button label={rejectLabel} icon={getPropValue('rejectIcon')} className={rejectClassName} onClick={reject} autoFocus={focusReject} />
<Button label={acceptLabel} icon={getPropValue('acceptIcon')} className={acceptClassName} onClick={accept} autoFocus={!focusReject} />

Describe alternatives you have considered

No response

Additional context

The same could be done for confirmPopup.

@KOliver94 KOliver94 added Status: Discussion Issue or pull request needs to be discussed by Core Team Type: New Feature Issue contains a new feature or new component request labels Feb 14, 2023
@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 Feb 14, 2023
@melloware
Copy link
Member

in PrimeVue the property is called defaultFocus

image

@melloware melloware changed the title ConfirmDialog: Add option to autoFocus reject button ConfirmDialog: Add defaultFocus option like PrimeVue Feb 14, 2023
@melloware melloware removed Status: Discussion Issue or pull request needs to be discussed by Core Team Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 15, 2023
@melloware melloware assigned melloware and unassigned habubey Nov 25, 2023
@melloware melloware added this to the 10.2.0 milestone Nov 25, 2023
melloware added a commit to melloware/primereact that referenced this issue Nov 26, 2023
@melloware melloware changed the title ConfirmDialog: Add defaultFocus option like PrimeVue ConfirmDialog/ConfirmPopup: Add defaultFocus option like PrimeVue Nov 26, 2023
@mertsincan mertsincan modified the milestones: 10.2.0, 10.3.0 Nov 27, 2023
@melloware melloware modified the milestones: 10.3.0, 10.2.2 Nov 27, 2023
@melloware melloware modified the milestones: 10.3.0, 10.2.2 Dec 5, 2023
@melloware melloware modified the milestones: 10.3.0, 10.3.1 Jan 8, 2024
@melloware melloware reopened this Jan 8, 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 Jan 8, 2024
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 8, 2024
melloware added a commit to melloware/primereact that referenced this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
4 participants