-
Notifications
You must be signed in to change notification settings - Fork 0
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
SFD-181: Implement ARIA tabs patterns #133
base: main
Are you sure you want to change the base?
Changes from all commits
7f29cc3
7542d5a
4f25d20
ab53330
44f87aa
a564db4
60b1536
de3e455
69f87af
0d66af4
d0eaed2
ff72388
eddf8ae
ef084dc
4aa19b6
ee2ffc3
7439603
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<form (ngSubmit)="handleSubmit()" [formGroup]="estimatorForm" class="tce-w-full tce-flex tce-flex-col tce-gap-6"> | ||
<form | ||
(ngSubmit)="handleSubmit()" | ||
[formGroup]="estimatorForm" | ||
class="tce-w-full tce-flex tce-flex-col tce-gap-6" | ||
tabindex="0"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be in the tab sequence now that it's in a tabpanel. The other tabpanels are already behaving that way so I've added it here rather than on the actual tabpanel element since that was causing other panels to appear twice in the tab sequence. |
||
<div formGroupName="upstream"> | ||
@if (errorSummaryState.showErrorSummary) { | ||
<error-summary [validationErrors]="errorSummaryState.validationErrors"></error-summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
@if (active()) { | ||
<div role="tabpanel" [hidden]="!active()" [id]="tabIdPrefix + 'Tabpanel'" [attr.aria-labelledby]="tabIdPrefix + 'Tab'"> | ||
<ng-content></ng-content> | ||
} | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
<div class="tce-w-full tce-flex tce-mb-2" role="tablist"> | ||
@for (tab of tabs; track tab.title) { | ||
<div | ||
@for (tab of tabs; track tab.title()) { | ||
<button | ||
#tabButton | ||
role="tab" | ||
[id]="tab.tabIdPrefix + 'Tab'" | ||
[attr.aria-controls]="tab.tabIdPrefix + 'Tabpanel'" | ||
[class.tce-active-tab]="tab.active()" | ||
[tabindex]="tab.active() ? 0 : -1" | ||
[attr.aria-selected]="tab.active() ? true : false" | ||
(click)="selectTab(tab)" | ||
(keydown.enter)="selectTab(tab)" | ||
tabindex="0" | ||
(keydown)="onKeydown($event, $index)" | ||
class="tce-p-2 tce-cursor-pointer tce-border-b-2 tce-border-transparent hover:tce-border-slate-300"> | ||
{{ tab.title() }} | ||
</div> | ||
</button> | ||
} | ||
</div> | ||
<div role="tabpanel"> | ||
<ng-content></ng-content> | ||
</div> | ||
<ng-content></ng-content> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ <h1 class="tce-text-3xl tce-mb-6">Technology Carbon Estimator</h1> | |
(formReset)="handleFormReset()"></carbon-estimator-form> | ||
</tab-item> | ||
<tab-item [title]="'Assumptions and Limitations'"> | ||
<assumptions-and-limitation aria-live="polite"></assumptions-and-limitation> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I originally removed this when changing some other aria-live values but having reverted those changes and rechecked, I don't think this is changing the behaviour now although that could just be my screen reader settings. I've left it off for now since other elements placed directly inside the tab-item components do not have this set. |
||
<assumptions-and-limitation></assumptions-and-limitation> | ||
</tab-item> | ||
</tabs> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the panels are hidden when not selected rather than being removed from the DOM there are 2 elements in the DOM with the old text so I've used the start of the second sentence in the section instead.