Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

added labels and ids to section form tabs #1798

Merged
merged 21 commits into from
Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3622b9c
added labels and ids to section form tabs
blackbaud-conorwright Jul 3, 2018
59d72df
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
blackbaud-conorwright Jul 11, 2018
dd22c39
Merge remote-tracking branch 'upstream/master' into fix-sectioned-for…
blackbaud-conorwright Jul 18, 2018
645766d
moved aria inputs to vertical tab and set its role to tab
blackbaud-conorwright Jul 18, 2018
1c7246a
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
blackbaud-conorwright Jul 18, 2018
04d417e
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
blackbaud-conorwright Jul 18, 2018
0f84aa0
fixed id to not populate when undefined. added tablist role
blackbaud-conorwright Jul 19, 2018
deec877
hiding tab and content instead of erasing
blackbaud-conorwright Jul 20, 2018
450e70c
Merge remote-tracking branch 'upstream/master' into fix-sectioned-for…
blackbaud-conorwright Jul 23, 2018
7f75fc6
added testing and switched to using getters
blackbaud-conorwright Jul 24, 2018
0c22f10
removed reversed condition
blackbaud-conorwright Jul 24, 2018
79b1507
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
blackbaud-conorwright Jul 24, 2018
90c6e0d
fixed coverage misses
blackbaud-conorwright Jul 30, 2018
5ef28b3
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
blackbaud-conorwright Jul 30, 2018
4cfd4cf
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
Blackbaud-SteveBrush Jul 31, 2018
acd4369
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
blackbaud-conorwright Aug 1, 2018
b3cfc15
removed use of forEach
blackbaud-conorwright Aug 1, 2018
3a0dded
removed leftover forEach
blackbaud-conorwright Aug 2, 2018
16d53a6
Merge remote-tracking branch 'origin' into fix-sectioned-form-tabs-mi…
blackbaud-conorwright Sep 6, 2018
a0da74e
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
Blackbaud-TrevorBurch Sep 6, 2018
c81f6ca
Merge branch 'master' into fix-sectioned-form-tabs-missing-labels
Blackbaud-TrevorBurch Sep 6, 2018
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
20 changes: 14 additions & 6 deletions src/modules/sectioned-form/sectioned-form-section.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<sky-vertical-tab
<sky-vertical-tab
role="tab"

Choose a reason for hiding this comment

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

Should we rethink how we're adding these attributes? In the sectioned form template, this works, but what if a consumer implements the vertical tab by itself? I'm assuming we'd want the same roles, etc. applied automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. I definitely see role="tab" being there, but then we would probably want them to set their own controls. Hmm, I'll switch these to being on the content of a verticaly tab and take them as input on it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Blackbaud-SteveBrush I've moved the attributes to be inputs on the vertical tab, including ID. Let me know what you think when you get the chance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, hold off. This is failing for a lying accessibility issue 😕
I'm currently trying to fix it

[active]="active"
[attr.aria-selected]="active"
[attr.aria-controls]="sectionContentId"
[id]="sectionTabId"
[ngClass]="{
'sky-tab-field-required': fieldRequired,
'sky-tab-field-invalid': fieldInvalid
}"
[tabHeading]="heading"
[tabHeaderCount]="itemCount"
[active]="active"
[showTabRightArrow]="true"
[tabHeading]="heading"
[tabHeaderCount]="itemCount"
>
<div #tabContent>
<div
role="tabpanel"
[attr.aria-labelledby]="sectionTabId"
[id]="sectionContentId"
#tabContent>
<ng-content></ng-content>
</div>
</sky-vertical-tab>
</sky-vertical-tab>
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ import 'rxjs/add/operator/takeUntil';
import { SkyVerticalTabComponent } from './../vertical-tabset/vertical-tab.component';
import { SkySectionedFormService } from './sectioned-form.service';

let nextId = 0;

@Component({
selector: 'sky-sectioned-form-section',
templateUrl: './sectioned-form-section.component.html',
providers: [SkySectionedFormService],
styleUrls: ['./sectioned-form-section.component.scss']
})
export class SkySectionedFormSectionComponent implements OnInit, OnDestroy {
public sectionTabId = `sky-sectioned-form-tab-${++nextId}`;
public sectionContentId = `sky-sectioned-form-section-${++nextId}`;

@Input()
public heading: string;
Expand Down
12 changes: 8 additions & 4 deletions src/modules/sectioned-form/sectioned-form.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<div class="sky-sectioned-form" (window:resize)="tabService.updateContent()">
<div
<div
aria-orientation="vertical"
class="sky-sectioned-form"
role="tablist"
(window:resize)="tabService.updateContent()">
<div
*ngIf="tabsVisible()"
class="sky-sectioned-form-tabs"
[@tabEnter]="tabService.animationVisibleState"
>
<ng-content></ng-content>
</div>
<div
#skySectionSideContent
<div
#skySectionSideContent
*ngIf="tabService.contentVisible()"
class="sky-sectioned-form-content"
[@contentEnter]="tabService.animationVisibleState"
Expand Down
23 changes: 23 additions & 0 deletions src/modules/sectioned-form/sectioned-form.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,29 @@ describe('Sectioned form component', () => {
expect(invalidTab.classList.contains('sky-tab-field-invalid')).toBe(true);
});

it('section should have appropriate aria labels', () => {
let fixture = createTestComponent();
let el = fixture.nativeElement;

fixture.detectChanges();

// check section is not invalid
let tabs = el.querySelectorAll('sky-vertical-tab');
expect(tabs.length).toBe(2);

let inactiveTab = tabs[0];
let inactiveTabContent = el.querySelector('#' + inactiveTab.getAttribute('aria-controls'));
expect(inactiveTab.getAttribute('aria-selected')).toBeFalsy();
expect(inactiveTab.getAttribute('aria-controls')).toBe(inactiveTabContent.id);
expect(inactiveTabContent.getAttribute('aria-labelledby')).toBe(inactiveTab.id);

let activeTab = tabs[1];
let activeTabContent = el.querySelector('#' + activeTab.getAttribute('aria-controls'));
expect(activeTab.getAttribute('aria-selected')).toBe('true');
expect(activeTab.getAttribute('aria-controls')).toBe(activeTabContent.id);
expect(activeTabContent.getAttribute('aria-labelledby')).toBe(activeTab.id);
});

it('should show content after resizing screen', () => {
mockQueryService.current = SkyMediaBreakpoints.xs;
let fixture = createTestComponent();
Expand Down