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

Fixed #14798 - ProgressSpinner | Unable to set aria-label #14800

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/app/components/progressspinner/progressspinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ChangeDetectionStrategy, Component, Input, NgModule, ViewEncapsulation
@Component({
selector: 'p-progressSpinner',
template: `
<div class="p-progress-spinner" [ngStyle]="style" [ngClass]="styleClass" role="progressbar" [attr.aria-busy]="true" [attr.data-pc-name]="'progressspinner'" [attr.data-pc-section]="'root'">
<div class="p-progress-spinner" [ngStyle]="style" [ngClass]="styleClass" role="progressbar" [attr.aria-label]="ariaLabel" [attr.aria-busy]="true" [attr.data-pc-name]="'progressspinner'" [attr.data-pc-section]="'root'">
<svg class="p-progress-spinner-svg" viewBox="25 25 50 50" [style.animation-duration]="animationDuration" [attr.data-pc-section]="'root'">
<circle class="p-progress-spinner-circle" cx="50" cy="50" r="20" [attr.fill]="fill" [attr.stroke-width]="strokeWidth" stroke-miterlimit="10" />
</svg>
Expand Down Expand Up @@ -46,6 +46,11 @@ export class ProgressSpinner {
* @group Props
*/
@Input() animationDuration: string = '2s';
/**
* Used to define a aria label attribute the current element.
* @group Props
*/
@Input() ariaLabel: string | undefined;
}

@NgModule({
Expand Down
6 changes: 3 additions & 3 deletions src/app/showcase/doc/progressspinner/basicdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import { Code } from '../../domain/code';
<p>An infinite spin animation is displayed by default.</p>
</app-docsectiontext>
<div class="card flex justify-content-center">
<p-progressSpinner aria-label="loading"></p-progressSpinner>
<p-progressSpinner ariaLabel="loading"></p-progressSpinner>
</div>
<app-code [code]="code" selector="progress-spinner-basic-demo"></app-code>
`
})
export class BasicDoc {
code: Code = {
basic: `<p-progressSpinner></p-progressSpinner>`,
basic: `<p-progressSpinner ariaLabel="loading"></p-progressSpinner>`,
html: `<div class="card flex justify-content-center">
<p-progressSpinner></p-progressSpinner>
<p-progressSpinner ariaLabel="loading"></p-progressSpinner>
</div>`,
typescript: `
import { Component } from '@angular/core';
Expand Down
Loading