Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/react-bootstrap-table2-toolkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ Custom the style on input element.
#### delay = [number]
milionsecond for debounce user input.

#### srText = [string]
Customize the screen reader text for the search input. (Default: "Search this table")

### Search Options

#### defaultSearch - [string]
Expand Down
15 changes: 10 additions & 5 deletions packages/react-bootstrap-table2-toolkit/src/search/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,24 @@ class SearchBar extends React.Component {
className,
style,
placeholder,
tableId
tableId,
srText
} = this.props;

return (
<label
htmlFor={ `search-bar-${tableId}` }
className="search-label"
>
<span className="sr-only">Search this table</span>
<span id={ `search-bar-${tableId}-label` } className="sr-only">
{ srText }
</span>
<input
ref={ n => this.input = n }
id={ `search-bar-${tableId}` }
type="text"
style={ style }
aria-label="enter text you want to search"
aria-labelledby={ `search-bar-${tableId}-label` }
onKeyUp={ () => this.onKeyup() }
onChange={ this.onChangeValue }
className={ `form-control ${className}` }
Expand All @@ -89,7 +92,8 @@ SearchBar.propTypes = {
style: PropTypes.object,
delay: PropTypes.number,
searchText: PropTypes.string,
tableId: PropTypes.string
tableId: PropTypes.string,
srText: PropTypes.string
};

SearchBar.defaultProps = {
Expand All @@ -98,7 +102,8 @@ SearchBar.defaultProps = {
placeholder: 'Search',
delay: 250,
searchText: '',
tableId: '0'
tableId: '0',
srText: 'Search this table'
};

export default SearchBar;