diff --git a/packages/react/src/components/Toggle/Toggle.js b/packages/react/src/components/Toggle/Toggle.js index 1d1072091506..5d950ba4a32a 100644 --- a/packages/react/src/components/Toggle/Toggle.js +++ b/packages/react/src/components/Toggle/Toggle.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import React from 'react'; +import React, { useRef } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { useControllableState } from '../../internal/useControllableState'; @@ -29,6 +29,7 @@ export function Toggle({ ...other }) { const prefix = usePrefix(); + const buttonElement = useRef(null); const [checked, setChecked] = useControllableState({ value: toggled, onChange: onToggle, @@ -71,9 +72,27 @@ export function Toggle({ }); return ( -
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions +
{ + // the underlying