Skip to content

Commit

Permalink
fix(DataTable): remove hard-coded ID for <Search> (carbon-design-syst…
Browse files Browse the repository at this point in the history
…em#559)

Also made a change to `<Search>` to make `id` prop fully optional.
Fixes carbon-design-system#552.
  • Loading branch information
asudoh authored and marijohannessen committed Jan 31, 2018
1 parent 4aad18b commit 9028a15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/DataTable/DataTable-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class BasicDataTable extends Component {
</DataTableActionList>
</DataTableBatchActions>
<DataTableSearch
id="id-search"
onInput={this.searchTable}
onChange={this.searchTable}
/>
Expand Down
1 change: 0 additions & 1 deletion src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ export const DataTableSearch = props => {
className={className}
{...other}
small
id="search-2"
labelText="Filter table"
placeHolderText="Search"
onChange={onChange}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ export default class Search extends Component {
const {
className,
type,
id,
id = (this._inputId =
this._inputId ||
`search__input__id_${Math.random()
.toString(36)
.substr(2)}`),
placeHolderText,
labelText,
small,
Expand Down

0 comments on commit 9028a15

Please sign in to comment.