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

Fixed a11y issue in add a failure instance panel. #123

Merged
merged 7 commits into from
Jan 25, 2019
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
34 changes: 2 additions & 32 deletions src/DetailsView/Styles/detailsview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,8 @@ div.insights-dialog-main-override {
color: $neutral-100;

.header-text {
padding-left: 16px;
padding-right: 16px;
}

@media (min-width: 768px) {
.header-text {
padding-left: 32px;
padding-right: 32px;
}
}

@media (min-width: 1366px) {
.header-text {
padding-left: 40px;
padding-right: 40px;
}
}

.header-text {
font-weight: lighter;
}

/*
Office Fabric (v5.x) panel breaks in certain scenarios when the viewport is decreased to a certain size (e.g. when splitting in half on a 1080p screen)
*/
.ms-Panel-main {
left: auto !important;
color: $neutral-100;
font-size: 2em;
}
}

Expand Down Expand Up @@ -225,11 +200,6 @@ div.insights-dialog-main-override {
margin-top: 30px;
font-size: 21px;
}
.ms-Panel-main {
.ms-TextField {
margin-bottom: 12px;
}
}
}

.preview-features-panel {
Expand Down
10 changes: 2 additions & 8 deletions src/DetailsView/components/generic-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,13 @@ export class GenericPanel extends React.Component<GenericPanelProps> {
className={css('generic-panel', this.props.className)}
isLightDismiss={true}
onDismiss={this.props.onDismiss}
onRenderHeader={this.renderHeader}
closeButtonAriaLabel={this.props.closeButtonAriaLabel}
hasCloseButton={this.props.hasCloseButton}
headerText={this.props.title}
headerClassName="header-text"
>
{this.props.children}
</Panel>
);
}

@autobind
protected renderHeader(): JSX.Element {
return <div>
<h1 className="header-text">{this.props.title}</h1>
</div>;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ exports[`Preview Features Panel should match content in snapshot 1`] = `
<div
class="ms-Panel-contentInner contentInner-000"
>
<div>
<h1
class="header-text"
<div
class="ms-Panel-header header-000"
>
<p
aria-level="2"
class="ms-Panel-headerText header-text headerText-000"
id="Panel11-headerText"
role="heading"
>
Preview features
</h1>
</p>
</div>
<div
class="ms-Panel-scrollableContent scrollableContent-000"
Expand Down
34 changes: 3 additions & 31 deletions src/tests/unit/tests/DetailsView/components/generic-panel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import * as React from 'react';

import { GenericPanel, GenericPanelProps } from '../../../../../DetailsView/components/generic-panel';

class TestableDetailsViewPanel extends GenericPanel {
public getRenderHeader() {
return this.renderHeader;
}
}

describe('DetailsViewPanelTest', () => {
test('constructor', () => {
const testSubject = new GenericPanel({} as GenericPanelProps);
Expand All @@ -32,7 +26,7 @@ describe('DetailsViewPanelTest', () => {
hasCloseButton: true,
};

const testSubject = new TestableDetailsViewPanel(testProps);
const testSubject = new GenericPanel(testProps);

const expected = (
<Panel isLightDismiss={true}
Expand All @@ -41,37 +35,15 @@ describe('DetailsViewPanelTest', () => {
customWidth={'550px'}
className={'generic-panel panel-custom-class'}
onDismiss={testProps.onDismiss}
onRenderHeader={testSubject.getRenderHeader()}
closeButtonAriaLabel={testProps.closeButtonAriaLabel}
hasCloseButton={true}
headerText={testProps.title}
headerClassName="header-text"
>
{childContent}
</Panel>
);

expect(testSubject.render()).toEqual(expected);
});

test('renderHeader', () => {
const panelTitle = 'panel title';
const testProps: GenericPanelProps = {
isOpen: true,
onDismiss: () => { },
title: panelTitle,
className: 'panel-custom-class',
closeButtonAriaLabel: 'close button label',
hasCloseButton: true,
};

const testSubject = new TestableDetailsViewPanel(testProps);
const renderHeader = testSubject.getRenderHeader();

const expected = (
<div>
<h1 className={'header-text'}>{panelTitle}</h1>
</div>
);

expect(renderHeader()).toEqual(expected);
});
});