Skip to content

Commit

Permalink
feat(slider): Handle aria-valuetext customizability
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoOleksiyenko authored and quentinderoubaix committed Feb 26, 2024
1 parent 37404bc commit 3245b7c
Show file tree
Hide file tree
Showing 9 changed files with 2,006 additions and 1,260 deletions.
6 changes: 5 additions & 1 deletion angular/lib/src/components/slider/slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import {take} from 'rxjs';
[attr.aria-readonly]="state().readonly ? true : null"
[attr.aria-disabled]="state().disabled ? true : null"
[attr.aria-valuenow]="item.value"
[attr.aria-valuetext]="item.value"
[attr.aria-valuetext]="item.ariaValueText"
[attr.aria-label]="item.ariaLabel"
[attr.aria-orientation]="state().vertical ? 'vertical' : null"
[disabled]="state().disabled"
Expand Down Expand Up @@ -170,6 +170,10 @@ export class SliderComponent extends BaseWidgetDirective<SliderWidget> {
* Return the value for the 'aria-label' attribute for the handle
*/
@Input('auAriaLabelHandle') ariaLabelHandle: ((value: number, sortedIndex: number, index: number) => string) | undefined;
/**
* Return the value for the 'aria-valuetext' attribute for the handle
*/
@Input('auAriaValueText') ariaValueText: ((value: number, sortedIndex: number, index: number) => string) | undefined;

/**
* If `true` slider value cannot be changed but the slider is still focusable
Expand Down
9 changes: 9 additions & 0 deletions common/propsValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ const propsValuesList = {
simpleLabel: {value: getPaginationDefaultConfig().ariaPageLabel, label: 'SimpleLabel'},
pageLabel: {value: (processPage: number, pageCount: number) => `Page ${processPage} of ${pageCount}`, label: 'PageLabel'},
slotNumberLabel: {value: getPaginationDefaultConfig().slotNumberLabel, label: 'SlotNumberLabel'},
//slider
sliderLabelHandleDefault: {
value: (value: number) => `${value}`,
label: 'SliderLabelHandleDefault',
},
sliderValueTextUnits: {
value: (value: number) => `${value} units`,
label: 'SliderValueTextUnits',
},
};

export const getPropValues = (config: Record<string, any>) => {
Expand Down
Loading

0 comments on commit 3245b7c

Please sign in to comment.