Skip to content

Commit 60becd0

Browse files
authored
Fixed accessibility of search text field (#130)
* Fixed accessibility of search text field * Patch version bump * Made ariaLabel overridable
1 parent c480726 commit 60becd0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-storefront",
3-
"version": "8.16.0",
3+
"version": "8.16.1",
44
"description": "Build and deploy e-commerce progressive web apps (PWAs) in record time.",
55
"module": "./index.js",
66
"license": "Apache-2.0",

src/search/SearchField.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const useStyles = makeStyles(styles, { name: 'RSFSearchField' })
9090
const SearchField = forwardRef(
9191
(
9292
{
93+
ariaLabel,
9394
classes,
9495
onChange,
9596
submitButtonVariant,
@@ -126,6 +127,7 @@ const SearchField = forwardRef(
126127
<div className={classes.inputWrap}>
127128
<input
128129
{...others}
130+
aria-label={ariaLabel}
129131
type="text"
130132
value={value}
131133
onChange={e => onChange(e.target.value)}
@@ -178,6 +180,10 @@ const SearchField = forwardRef(
178180
)
179181

180182
SearchField.propTypes = {
183+
/**
184+
* Label for accessibility, defaults to search-text
185+
*/
186+
ariaLabel: PropTypes.string,
181187
/**
182188
* Override or extend the styles applied to the component. See [CSS API](#css) below for more details.
183189
*/
@@ -229,6 +235,7 @@ SearchField.defaultProps = {
229235
submitButtonVariant: 'fab',
230236
showClearButton: true,
231237
placeholder: 'Search...',
238+
ariaLabel: 'search-text',
232239
name: 'q',
233240
value: '',
234241
}

0 commit comments

Comments
 (0)