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

a11y: accessibility 2027 #2698

Merged
merged 3 commits into from
Apr 17, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,7 @@ export const ProjectTree: React.FC<IProjectTreeProps> = props => {
}
styles={groupListStyle}
/>
<ActionButton
tabIndex={1}
iconProps={addIconProps}
css={addButton(0)}
onClick={onAdd}
data-testid="ProjectTreeNewDialog"
>
<ActionButton iconProps={addIconProps} css={addButton(0)} onClick={onAdd} data-testid="ProjectTreeNewDialog">
{formatMessage('New Dialog ..')}
</ActionButton>
</div>
Expand Down
26 changes: 14 additions & 12 deletions Composer/packages/client/src/components/ProjectTree/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,20 @@ export const itemText = (depth: number) => css`
cursor: pointer;
`;

export const moreButton: IButtonStyles = {
root: {
padding: '0 4px',
alignSelf: 'stretch',
height: 'auto',
visibility: 'hidden',
width: '16px',
},
menuIcon: {
fontSize: '14px',
color: '#000',
},
export const moreButton = (isActive: boolean): IButtonStyles => {
return {
root: {
padding: '0 4px',
alignSelf: 'stretch',
visibility: isActive ? 'visible' : 'hidden',
height: 'auto',
width: '16px',
},
menuIcon: {
fontSize: '14px',
color: '#000',
},
};
};

export const moreMenu: Partial<ICalloutContentStyles> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ interface ITreeItemProps {

const onRenderItem = (item: IOverflowSetItemProps) => {
return (
<div role="cell" css={itemText(item.depth)}>
<div role="cell" css={itemText(item.depth)} tabIndex={0}>
{item.depth !== 0 && <Icon iconName="Flow" styles={{ root: { marginRight: '8px' } }} />}
{item.displayName}
</div>
);
};

const onRenderOverflowButton = (isRoot: boolean) => {
const onRenderOverflowButton = (isRoot: boolean, isActive: boolean) => {
const showIcon = !isRoot;
return overflowItems => {
return showIcon ? (
<IconButton
role="cell"
className="dialog-more-btn"
data-testid="dialogMoreButton"
styles={moreButton}
styles={moreButton(isActive)}
menuIconProps={{ iconName: 'MoreVertical' }}
menuProps={{ items: overflowItems, styles: menuStyle }}
/>
Expand All @@ -48,7 +48,6 @@ export const TreeItem: React.FC<ITreeItemProps> = props => {
return (
<div
role="presentation"
tabIndex={1}
css={navItem(isActive, !!isSubItemActive)}
onClick={() => {
onSelect(link.id);
Expand Down Expand Up @@ -78,7 +77,7 @@ export const TreeItem: React.FC<ITreeItemProps> = props => {
css={overflowSet}
data-testid={`DialogTreeItem${link.id}`}
onRenderItem={onRenderItem}
onRenderOverflowButton={onRenderOverflowButton(link.isRoot)}
onRenderOverflowButton={onRenderOverflowButton(link.isRoot, isActive)}
/>
</div>
);
Expand Down