Skip to content

Commit

Permalink
fix(NumberInput): add aria-label on increase and decrease buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
CoroDaniel authored and cipak committed Mar 18, 2022
1 parent 44f118b commit 6c5af2e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ Array [
className="wxc-number-input__controls"
>
<button
aria-label="Increase value"
autoFocus={false}
className="wxc wxc-button wxc-number-input__increment-button wxc-button--ghost"
disabled={false}
Expand Down Expand Up @@ -484,6 +485,7 @@ Array [
</button>

<button
aria-label="Decrease value"
autoFocus={false}
className="wxc wxc-button wxc-number-input__decrement-button wxc-button--ghost"
disabled={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ Array [
className="wxc-number-input__controls"
>
<button
aria-label="Increase value"
autoFocus={false}
className="wxc wxc-button wxc-number-input__increment-button wxc-button--ghost"
disabled={false}
Expand Down Expand Up @@ -673,6 +674,7 @@ Array [
</button>

<button
aria-label="Decrease value"
autoFocus={false}
className="wxc wxc-button wxc-number-input__decrement-button wxc-button--ghost"
disabled={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ Array [
className="wxc-number-input__controls"
>
<button
aria-label="Increase value"
autoFocus={false}
className="wxc wxc-button wxc-number-input__increment-button wxc-button--ghost"
disabled={false}
Expand Down Expand Up @@ -762,6 +763,7 @@ Array [
</button>

<button
aria-label="Decrease value"
autoFocus={false}
className="wxc wxc-button wxc-number-input__decrement-button wxc-button--ghost"
disabled={false}
Expand Down
18 changes: 16 additions & 2 deletions src/components/inputs/NumberInput/NumberInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Icon from '../../generic/Icon/Icon';

const HINTS = {
clearButton: 'Clear input',
increaseButton: 'Increase value',
decreaseButton: 'Decrease value',
};

/**
Expand Down Expand Up @@ -59,10 +61,22 @@ export default function NumberInput({

const rightControls = (
<div className={sc('controls')}>
<Button type="ghost" className={sc('increment-button')} onClick={handleIncrement} onMouseDown={(event) => event.stopPropagation()}>
<Button
ariaLabel={HINTS.increaseButton}
className={sc('increment-button')}
onClick={handleIncrement}
onMouseDown={(event) => event.stopPropagation()}
type="ghost"
>
<Icon name="control-up" size={13} />
</Button>
<Button type="ghost" className={sc('decrement-button')} onClick={handleDecrement} onMouseDown={(event) => event.stopPropagation()}>
<Button
ariaLabel={HINTS.decreaseButton}
className={sc('decrement-button')}
onClick={handleDecrement}
onMouseDown={(event) => event.stopPropagation()}
type="ghost"
>
<Icon name="control-down" size={13} />
</Button>
</div>
Expand Down

0 comments on commit 6c5af2e

Please sign in to comment.