Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 33 additions & 30 deletions Composer/packages/client/src/components/ProjectTree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
IGroupedList,
} from 'office-ui-fabric-react/lib/GroupedList';
import { SearchBox } from 'office-ui-fabric-react/lib/SearchBox';
import { FocusZone, FocusZoneDirection } from 'office-ui-fabric-react/lib/FocusZone';
import cloneDeep from 'lodash/cloneDeep';
import formatMessage from 'format-message';
import { DialogInfo, ITrigger } from '@bfc/shared';
Expand Down Expand Up @@ -163,18 +164,19 @@ export const ProjectTree: React.FC<IProjectTreeProps> = props => {
onResizeStop={handleResize}
>
<div className="ProjectTree" css={root} data-testid="ProjectTree">
<SearchBox
ariaLabel={formatMessage('Type dialog name')}
placeholder={formatMessage('Filter Dialog')}
styles={searchBox}
onChange={onFilter}
iconProps={{ iconName: 'Filter' }}
underlined
/>
<div
aria-live={'polite'}
aria-label={formatMessage(
`{
<FocusZone direction={FocusZoneDirection.vertical} isCircularNavigation={true}>
<SearchBox
ariaLabel={formatMessage('Type dialog name')}
placeholder={formatMessage('Filter Dialog')}
styles={searchBox}
onChange={onFilter}
iconProps={{ iconName: 'Filter' }}
underlined
/>
<div
aria-live={'polite'}
aria-label={formatMessage(
`{
dialogNum, plural,
=0 {No dialogs}
=1 {One dialog}
Expand All @@ -185,24 +187,25 @@ export const ProjectTree: React.FC<IProjectTreeProps> = props => {
0 {}
other {Press down arrow key to navigate the search results}
}`,
{ dialogNum: res.groups.length }
)}
/>
<GroupedList
{...res}
onRenderCell={onRenderCell}
componentRef={groupRef}
groupProps={
{
onRenderHeader: onRenderHeader,
onRenderShowAll: onRenderShowAll,
showEmptyGroups: true,
showAllProps: false,
isAllGroupsCollapsed: true,
} as Partial<IGroupRenderProps>
}
styles={groupListStyle}
/>
{ dialogNum: res.groups.length }
)}
/>
<GroupedList
{...res}
onRenderCell={onRenderCell}
componentRef={groupRef}
groupProps={
{
onRenderHeader: onRenderHeader,
onRenderShowAll: onRenderShowAll,
showEmptyGroups: true,
showAllProps: false,
isAllGroupsCollapsed: true,
} as Partial<IGroupRenderProps>
}
styles={groupListStyle}
/>
</FocusZone>
</div>
</Resizable>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ interface ITreeItemProps {

const onRenderItem = (item: IOverflowSetItemProps) => {
return (
<div role="cell" css={itemText(item.depth)} tabIndex={0} onFocus={item.onFocus} onBlur={item.onBlur}>
<div
role="cell"
css={itemText(item.depth)}
tabIndex={0}
onFocus={item.onFocus}
onBlur={item.onBlur}
data-is-focusable={true}
>
<div css={content} tabIndex={-1}>
{item.depth !== 0 && (
<Icon
Expand All @@ -47,11 +54,17 @@ const onRenderOverflowButton = (isRoot: boolean, isActive: boolean) => {
return showIcon ? (
<IconButton
role="cell"
data-is-focusable={isActive}
className="dialog-more-btn"
data-testid="dialogMoreButton"
styles={moreButton(isActive)}
menuIconProps={{ iconName: 'MoreVertical' }}
menuProps={{ items: overflowItems, styles: menuStyle }}
onKeyDown={e => {
if (e.key === 'Enter') {
e.stopPropagation();
}
}}
/>
) : null;
};
Expand Down Expand Up @@ -94,6 +107,9 @@ export const TreeItem: React.FC<ITreeItemProps> = props => {
data-testid={`DialogTreeItem${link.id}`}
onRenderItem={onRenderItem}
onRenderOverflowButton={onRenderOverflowButton(link.isRoot, isActive)}
//In 8.0 the OverflowSet will no longer be wrapped in a FocusZone
//remove this at that time
doNotContainWithinFocusZone={true}
/>
</div>
);
Expand Down