Skip to content

Commit

Permalink
Merge pull request #3209 from 10up/fix/3201
Browse files Browse the repository at this point in the history
Change disabling method to avoid losing focus on facets
  • Loading branch information
felipeelia committed Dec 16, 2022
2 parents bf2ddee + 581fb1b commit 788e0f1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions assets/js/instant-results/components/common/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ import { WPElement } from '@wordpress/element';
/**
* Checkbox component.
*
* @param {Option} props Component props.
* @param {Option} props Component props.
* @param {string} props.count Checkbox count.
* @param {string} props.id Checkbox ID.
* @param {string} props.id Checkbox ID.
* @param {string} props.label Checkbox label.
* @param {Function} props.onChange Change event handler.
*
* @returns {WPElement} Component element.
*/
export default ({ count, id, label, ...props }) => {
export default ({ count, disabled, id, label, onChange, ...props }) => {
return (
<div className="ep-search-checkbox">
<input className="ep-search-checkbox__input" id={id} type="checkbox" {...props} />{' '}
<input
aria-disabled={disabled}
className="ep-search-checkbox__input"
id={id}
onChange={!disabled ? onChange : null}
type="checkbox"
{...props}
/>{' '}
<label className="ep-search-checkbox__label" htmlFor={id}>
{label} {count && <span className="ep-search-checkbox__count">{count}</span>}
</label>
Expand Down

0 comments on commit 788e0f1

Please sign in to comment.