Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/primefaces/primeng
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Dec 1, 2023
2 parents 0618958 + c4761b6 commit a5d3bf2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/app/components/carousel/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ import { DomHandler } from 'primeng/dom';
<div
*ngFor="let item of value; let index = index"
[ngClass]="{ 'p-carousel-item': true, 'p-carousel-item-active': firstIndex() <= index && lastIndex() >= index, 'p-carousel-item-start': firstIndex() === index, 'p-carousel-item-end': lastIndex() === index }"
[attr.aria-hidden]="!(totalShiftedItems * -1 === value.length)"
[attr.aria-label]="ariaSlideNumber(index)"
[attr.aria-roledescription]="ariaSlideLabel()"
>
<ng-container *ngTemplateOutlet="itemTemplate; context: { $implicit: item }"></ng-container>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/app/components/galleria/galleria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ export class Galleria implements OnChanges, OnDestroy {
template: `
<div
[attr.id]="id"
[attr.role]="'region'"
*ngIf="value && value.length > 0"
[ngClass]="{
'p-galleria p-component': true,
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { FocusTrapModule } from 'primeng/focustrap';
template: `
<span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
<img [attr.src]="src" [attr.srcset]="srcSet" [attr.sizes]="sizes" [attr.alt]="alt" [attr.width]="width" [attr.height]="height" [attr.loading]="loading" [ngStyle]="imageStyle" [class]="imageClass" (error)="imageError($event)" />
<button *ngIf="preview" type="button" class="p-image-preview-indicator" (click)="onImageClick()" #previewButton [ngStyle]="{ height: height + 'px', width: width + 'px' }" style="border: 'none';">
<button *ngIf="preview" [attr.aria-label]="zoomImageAriaLabel" type="button" class="p-image-preview-indicator" (click)="onImageClick()" #previewButton [ngStyle]="{ height: height + 'px', width: width + 'px' }" style="border: 'none';">
<ng-container *ngIf="indicatorTemplate; else defaultTemplate">
<ng-container *ngTemplateOutlet="indicatorTemplate"></ng-container>
</ng-container>
Expand Down Expand Up @@ -376,6 +376,10 @@ export class Image implements AfterContentInit {
imagePreviewStyle() {
return { transform: 'rotate(' + this.rotate + 'deg) scale(' + this.scale + ')' };
}

get zoomImageAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.zoomImage : undefined;
}

containerClass() {
return {
Expand Down
8 changes: 6 additions & 2 deletions src/app/components/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { animate, style, transition, trigger } from '@angular/animations';
import { CommonModule } from '@angular/common';
import { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, Input, NgModule, OnDestroy, Optional, Output, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';
import { Message, MessageService, PrimeTemplate } from 'primeng/api';
import { PrimeNGConfig } from 'primeng/api';
import { CheckIcon } from 'primeng/icons/check';
import { ExclamationTriangleIcon } from 'primeng/icons/exclamationtriangle';
import { InfoCircleIcon } from 'primeng/icons/infocircle';
Expand Down Expand Up @@ -42,7 +43,7 @@ import { Subscription, timer } from 'rxjs';
<span *ngIf="msg.summary" class="p-message-summary" [attr.data-pc-section]="'summary'">{{ msg.summary }}</span>
<span *ngIf="msg.detail" class="p-message-detail" [attr.data-pc-section]="'detail'">{{ msg.detail }}</span>
</ng-template>
<button class="p-message-close p-link" (click)="removeMessage(i)" *ngIf="closable" type="button" pRipple [attr.aria-label]="'Close'" [attr.data-pc-section]="'closebutton'">
<button class="p-message-close p-link" (click)="removeMessage(i)" *ngIf="closable" type="button" pRipple [attr.aria-label]="closeAriaLabel" [attr.data-pc-section]="'closebutton'">
<TimesIcon [styleClass]="'p-message-close-icon'" [attr.data-pc-section]="'closeicon'" />
</button>
</div>
Expand Down Expand Up @@ -143,7 +144,7 @@ export class Messages implements AfterContentInit, OnDestroy {

contentTemplate: TemplateRef<any> | undefined;

constructor(@Optional() public messageService: MessageService, public el: ElementRef, public cd: ChangeDetectorRef) {}
constructor(@Optional() public messageService: MessageService, public el: ElementRef, public cd: ChangeDetectorRef, private config: PrimeNGConfig) {}

ngAfterContentInit() {
this.templates?.forEach((item) => {
Expand Down Expand Up @@ -229,6 +230,9 @@ export class Messages implements AfterContentInit, OnDestroy {

return null;
}
get closeAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.close : undefined;
}

ngOnDestroy() {
if (this.messageSubscription) {
Expand Down
10 changes: 8 additions & 2 deletions src/app/components/toast/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { ToastCloseEvent, ToastItemCloseEvent, ToastPositionType } from './toast
(keydown.enter)="onCloseIconClick($event)"
*ngIf="message?.closable !== false"
pRipple
[attr.aria-label]="'Close'"
[attr.aria-label]="closeAriaLabel"
[attr.data-pc-section]="'closebutton'"
>
<span *ngIf="message.closeIcon" [class]="'pt-1 text-base p-toast-message-icon pi ' + message.closeIcon"></span>
Expand Down Expand Up @@ -140,7 +140,7 @@ export class ToastItem implements AfterViewInit, OnDestroy {

timeout: any;

constructor(private zone: NgZone) {}
constructor(private zone: NgZone,private config: PrimeNGConfig) {}

ngAfterViewInit() {
this.initTimeout();
Expand Down Expand Up @@ -185,9 +185,15 @@ export class ToastItem implements AfterViewInit, OnDestroy {
event.preventDefault();
}

get closeAriaLabel() {
return this.config.translation.aria ? this.config.translation.aria.close : undefined;
}

ngOnDestroy() {
this.clearTimeout();
}


}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/app/showcase/doc/Image/accessibilitydoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Component } from '@angular/core';
template: ` <app-docsectiontext>
<h3>Screen Reader</h3>
<p>
The preview button is a native <i>button</i> element with an <i>aria-label</i> that refers to the <i>aria.zoomImage</i> property of the <a href="/configuration/#locale">locale</a> API by default, with <i>previewButtonProps</i>you may use
your own aria roles and attributes as any valid attribute is passed to the button element implicitly.
The preview button is a native <i>button</i> element with an <i>aria-label</i> that refers to the <i>aria.zoomImage</i> property of the <a href="/configuration/#locale">locale</a> API by default.
</p>
<p>When preview is active, <i>dialog</i> role with <i>aria-modal</i> is applied to the overlay image container.</p>
<p>Button controls use <i>aria.rotateRight</i>, <i>aria.rotateLeft</i>, <i>aria.zoomIn</i>, <i>aria.zoomOut</i> and <i>aria.close</i> from the <a href="/configuration/#locale">locale</a> API as <i>aria-label</i>.</p>
Expand Down

1 comment on commit a5d3bf2

@vercel
Copy link

@vercel vercel bot commented on a5d3bf2 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.