Skip to content

Commit

Permalink
Fixed accessibility of search text field (#130)
Browse files Browse the repository at this point in the history
* Fixed accessibility of search text field

* Patch version bump

* Made ariaLabel overridable
  • Loading branch information
dijs authored Aug 26, 2020
1 parent c480726 commit 60becd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-storefront",
"version": "8.16.0",
"version": "8.16.1",
"description": "Build and deploy e-commerce progressive web apps (PWAs) in record time.",
"module": "./index.js",
"license": "Apache-2.0",
Expand Down
7 changes: 7 additions & 0 deletions src/search/SearchField.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const useStyles = makeStyles(styles, { name: 'RSFSearchField' })
const SearchField = forwardRef(
(
{
ariaLabel,
classes,
onChange,
submitButtonVariant,
Expand Down Expand Up @@ -126,6 +127,7 @@ const SearchField = forwardRef(
<div className={classes.inputWrap}>
<input
{...others}
aria-label={ariaLabel}
type="text"
value={value}
onChange={e => onChange(e.target.value)}
Expand Down Expand Up @@ -178,6 +180,10 @@ const SearchField = forwardRef(
)

SearchField.propTypes = {
/**
* Label for accessibility, defaults to search-text
*/
ariaLabel: PropTypes.string,
/**
* Override or extend the styles applied to the component. See [CSS API](#css) below for more details.
*/
Expand Down Expand Up @@ -229,6 +235,7 @@ SearchField.defaultProps = {
submitButtonVariant: 'fab',
showClearButton: true,
placeholder: 'Search...',
ariaLabel: 'search-text',
name: 'q',
value: '',
}
Expand Down

0 comments on commit 60becd0

Please sign in to comment.