Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cb 5133 tree expand focus #2605

Merged
merged 9 commits into from
May 21, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Clickable } from '../../Clickable';
import { getComputed } from '../../getComputed';
import { Icon } from '../../Icon';
import { Loader } from '../../Loader/Loader';
import { useTranslate } from '../../localization/useTranslate';
import { s } from '../../s';
import { useS } from '../../useS';
import { useStateDelay } from '../../useStateDelay';
Expand All @@ -30,6 +31,7 @@ interface Props {
}

export const TreeNodeExpand = observer<Props>(function TreeNodeExpand({ leaf, big, filterActive, disabled, className }) {
const translate = useTranslate();
const styles = useS(style);
const context = useContext(TreeNodeContext);

Expand Down Expand Up @@ -86,11 +88,16 @@ export const TreeNodeExpand = observer<Props>(function TreeNodeExpand({ leaf, bi
}
}

const title = translate('ui_expand');

return (
<Clickable
as="div"
role="button"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be role be a part of Clickable?

title={title}
aria-label={title}
className={s(styles, { treeNodeExpand: true, expanded: context.expanded, big }, className)}
focusable={!disabled && expandable}
focusable={expandable}
disabled={disabled || !expandable}
onClick={handleExpand}
onDoubleClick={handleDbClick}
Expand Down
Loading