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

fix: focus order and alignment of buttons in dialog #554

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,46 @@
<ng-container #container></ng-container>
<ng-content></ng-content>
</div>
<div class="w-full flex flex-row-reverse justify-content-between column-gap-2">
<div class="flex flex-row-reverse flex-wrap column-gap-2 row-gap-2">
<div>
<button
id="buttonDialogPrimaryButton"
pButton
[icon]="dialogData.config.primaryButtonDetails!.icon !== undefined ? dialogData.config.primaryButtonDetails!.icon : ''"
(click)="primaryButtonAction()"
[label]="dialogData.config.primaryButtonDetails!.key | translate:dialogData.config.primaryButtonDetails?.parameters"
[disabled]="primaryButtonDisabled$ | async"
[pTooltip]="dialogData.config.primaryButtonDetails!.tooltipKey ? (dialogData.config.primaryButtonDetails!.tooltipKey | translate) : null"
[tooltipPosition]="dialogData.config.primaryButtonDetails?.tooltipPosition ?? ''"
[attr.aria-label]="dialogData.config.primaryButtonDetails!.key | translate:dialogData.config.primaryButtonDetails?.parameters"
></button>
<div
class="w-full flex-column sm:flex-row align-content-end sm:align-content-start flex flex-wrap row-gap-2 column-gap-2"
>
<ng-container *ngFor="let button of leftCustomButtons; index as i">
<div [ngStyle]="{'margin-right': (i === leftCustomButtons.length - 1) ? 'auto' : 0}">
<ng-container *ngTemplateOutlet="customButton; context: {button: button}"> </ng-container>
</div>
</ng-container>
<ng-container *ngFor="let button of rightCustomButtons">
<div>
<button
id="buttonDialogSecondaryButton"
pButton
*ngIf="dialogData.config.secondaryButtonIncluded"
[icon]="dialogData.config.secondaryButtonDetails!.icon !== undefined ? dialogData.config.secondaryButtonDetails!.icon : ''"
(click)="secondaryButtonAction()"
[label]="dialogData.config.secondaryButtonDetails!.key | translate:dialogData.config.secondaryButtonDetails?.parameters"
[disabled]="secondaryButtonDisabled$ | async"
[pTooltip]="dialogData.config.secondaryButtonDetails!.tooltipKey ? (dialogData.config.secondaryButtonDetails!.tooltipKey | translate) : null"
[tooltipPosition]="dialogData.config.secondaryButtonDetails?.tooltipPosition ?? ''"
[attr.aria-label]="dialogData.config.secondaryButtonDetails!.key | translate:dialogData.config.secondaryButtonDetails?.parameters"
></button>
</div>
<div *ngFor="let button of rightCustomButtons">
<ng-container *ngTemplateOutlet="customButton; context: {button: button}"> </ng-container>
</div>
</ng-container>
<div>
<button
id="buttonDialogSecondaryButton"
pButton
*ngIf="dialogData.config.secondaryButtonIncluded"
[icon]="dialogData.config.secondaryButtonDetails!.icon !== undefined ? dialogData.config.secondaryButtonDetails!.icon : ''"
(click)="secondaryButtonAction()"
[label]="dialogData.config.secondaryButtonDetails!.key | translate:dialogData.config.secondaryButtonDetails?.parameters"
[disabled]="secondaryButtonDisabled$ | async"
[pTooltip]="dialogData.config.secondaryButtonDetails!.tooltipKey ? (dialogData.config.secondaryButtonDetails!.tooltipKey | translate) : null"
[tooltipPosition]="dialogData.config.secondaryButtonDetails?.tooltipPosition ?? ''"
[attr.aria-label]="dialogData.config.secondaryButtonDetails!.key | translate:dialogData.config.secondaryButtonDetails?.parameters"
></button>
</div>
<div class="flex flex-wrap column-gap-2 row-gap-2">
<div *ngFor="let button of leftCustomButtons">
<ng-container *ngTemplateOutlet="customButton; context: {button: button}"> </ng-container>
</div>
<div>
<button
id="buttonDialogPrimaryButton"
pButton
autofocus
[icon]="dialogData.config.primaryButtonDetails!.icon !== undefined ? dialogData.config.primaryButtonDetails!.icon : ''"
(click)="primaryButtonAction()"
[label]="dialogData.config.primaryButtonDetails!.key | translate:dialogData.config.primaryButtonDetails?.parameters"
[disabled]="primaryButtonDisabled$ | async"
[pTooltip]="dialogData.config.primaryButtonDetails!.tooltipKey ? (dialogData.config.primaryButtonDetails!.tooltipKey | translate) : null"
[tooltipPosition]="dialogData.config.primaryButtonDetails?.tooltipPosition ?? ''"
[attr.aria-label]="dialogData.config.primaryButtonDetails!.key | translate:dialogData.config.primaryButtonDetails?.parameters"
></button>
</div>
</div>
</div>
Expand Down
Loading