mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make owner stack reachable by keyboard
This commit is contained in:
@@ -206,12 +206,25 @@ function OwnerView({ displayName, id }: { displayName: string, id: number }) {
|
||||
selectElementByID,
|
||||
]);
|
||||
|
||||
const handleKeyPress = useCallback(
|
||||
e => {
|
||||
if (e.key === ' ' || e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
selectElementByID(id);
|
||||
}
|
||||
},
|
||||
[id, selectElementByID]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
key={id}
|
||||
className={styles.Owner}
|
||||
onClick={handleClick}
|
||||
onKeyPress={handleKeyPress}
|
||||
title={displayName}
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
>
|
||||
{displayName}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user