Skip to content

Commit

Permalink
CMS-536: Add unique id to popular filters on find a park page
Browse files Browse the repository at this point in the history
  • Loading branch information
ayumi-oxd committed Jan 6, 2025
1 parent 6a63c84 commit 9f7e160
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/gatsby/src/components/search/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ const shortenFilterLabel = (label, filterType) => {
}
}

const uniqueId = (id, filterType) => {
if (filterType === "popular") {
return `popular-${id}`
} else {
return id
}
}

const Filter = ({ filterItems, selectedFilterItems, handleFilterCheck, filterType }) => {
return (
<Form.Group className="filter-options-container">
Expand All @@ -30,9 +38,9 @@ const Filter = ({ filterItems, selectedFilterItems, handleFilterCheck, filterTyp
).length === 1 ? true : false
return (
<Form.Check
id={item.code}
key={item.code}
aria-controls={item.code}
id={uniqueId(item.code, filterType)}
key={uniqueId(item.code, filterType)}
aria-controls={uniqueId(item.code, filterType)}
type="checkbox"
checked={checked}
onChange={event => {
Expand Down

0 comments on commit 9f7e160

Please sign in to comment.