Skip to content

Commit

Permalink
fix(number-field): add aria-valuetext to prevent VO announce %
Browse files Browse the repository at this point in the history
  • Loading branch information
bualoy-napat committed Jul 27, 2023
1 parent 48796fb commit 1f0eb91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/elements/src/number-field/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ export class NumberField extends FormFieldElement {
* inputmode="decimal" - show decimals keyboard by default
* role="spinbutton" - number field is actually a spinner
* aria-valuenow - current value or 0
* aria-valuetext - current value or 0, need this to improve user-friendly and human-understandable when screen reader announce value
* @keydown - Listener for `keydown` event. Runs `this.onInputKeyDown`
* @beforeinput - Listener for `beforeinput` event. Runs `this.onBeforeInputChange`
* @returns template map
Expand All @@ -876,6 +877,7 @@ export class NumberField extends FormFieldElement {
inputmode: 'decimal',
role: 'spinbutton',
'aria-valuenow': `${this.value || 0}`,
'aria-valuetext': `${this.value || 0}`,
'@keydown': this.onInputKeyDown,
'@beforeinput': this.onBeforeInputChange
};
Expand Down

0 comments on commit 1f0eb91

Please sign in to comment.