feat(accessibility): add tabbing to chart menu in dashboard (#26138)

Co-authored-by: geido <diegopucci.me@gmail.com>
Co-authored-by: Diego Pucci <geido@Diegos-MBP.wind3.hub>
This commit is contained in:
Elizabeth Thompson
2024-04-08 09:40:57 -07:00
committed by GitHub
parent 662c1ed618
commit 34b1db219c
24 changed files with 965 additions and 154 deletions

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useMemo, useState, useEffect } from 'react';
import React, { useMemo, useState, useEffect, useRef, RefObject } from 'react';
import {
css,
GenericDataType,
@@ -96,9 +96,20 @@ export const CopyToClipboardButton = ({
export const FilterInput = ({
onChangeHandler,
shouldFocus = false,
}: {
onChangeHandler(filterText: string): void;
shouldFocus?: boolean;
}) => {
const inputRef: RefObject<any> = useRef(null);
useEffect(() => {
// Focus the input element when the component mounts
if (inputRef.current && shouldFocus) {
inputRef.current.focus();
}
}, []);
const theme = useTheme();
const debouncedChangeHandler = debounce(onChangeHandler, SLOW_DEBOUNCE);
return (
@@ -113,6 +124,7 @@ export const FilterInput = ({
width: 200px;
margin-right: ${theme.gridUnit * 2}px;
`}
ref={inputRef}
/>
);
};