-
Notifications
You must be signed in to change notification settings - Fork 732
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
Issue 10255 improve coach tabs accessibility #11501
Changes from all commits
bb89506
855e993
9d4f675
3c11757
84fc429
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 |
---|---|---|
|
@@ -53,13 +53,13 @@ | |
</HeaderTableRow> | ||
</HeaderTable> | ||
<HeaderTabs :enablePrint="enablePrint"> | ||
<HeaderTab | ||
:text="coachString('reportsLabel')" | ||
:to="classRoute('ReportsLearnerReportPage', {})" | ||
/> | ||
<HeaderTab | ||
:text="coachString('activityLabel')" | ||
:to="classRoute('ReportsLearnerActivityPage', {})" | ||
<KTabsList | ||
ref="tabList" | ||
:tabsId="LEARNERS_TABS_ID" | ||
:ariaLabel="$tr('reportLearners')" | ||
:activeTabId="activeTabId" | ||
:tabs="tabs" | ||
@click="() => saveTabsClick(LEARNERS_TABS_ID)" | ||
/> | ||
</HeaderTabs> | ||
</div> | ||
|
@@ -71,16 +71,34 @@ | |
|
||
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; | ||
import commonCoach from '../common'; | ||
import { LEARNERS_TABS_ID, LearnersTabs } from '../../constants/tabsConstants'; | ||
import { useCoachTabs } from '../../composables/useCoachTabs'; | ||
|
||
export default { | ||
name: 'ReportsLearnerHeader', | ||
mixins: [commonCoach, commonCoreStrings], | ||
setup() { | ||
const { saveTabsClick, wereTabsClickedRecently } = useCoachTabs(); | ||
return { | ||
saveTabsClick, | ||
wereTabsClickedRecently, | ||
}; | ||
}, | ||
props: { | ||
enablePrint: { | ||
type: Boolean, | ||
required: false, | ||
default: false, | ||
}, | ||
activeTabId: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
LEARNERS_TABS_ID, | ||
}; | ||
}, | ||
computed: { | ||
learner() { | ||
|
@@ -115,13 +133,43 @@ | |
); | ||
return statuses.length; | ||
}, | ||
tabs() { | ||
return [ | ||
{ | ||
id: LearnersTabs.REPORTS, | ||
label: this.coachString('reportsLabel'), | ||
to: this.classRoute('ReportsLearnerReportPage', {}), | ||
}, | ||
{ | ||
id: LearnersTabs.ACTIVITY, | ||
label: this.coachString('activityLabel'), | ||
to: this.classRoute('ReportsLearnerActivityPage', {}), | ||
}, | ||
]; | ||
}, | ||
}, | ||
mounted() { | ||
// focus the active tab but only when it's likely | ||
// that this header was re-mounted as a result | ||
// of navigation after clicking a tab (focus shouldn't | ||
// be manipulated programatically in other cases, e.g. | ||
// when visiting the Plan page for the first time) | ||
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. Minor comment: "when visiting the Plan page" This is not the Plan page. I think that's result of copy-pasting, so perhaps we could just say "when visiting the page" to make future copies work without the need to adjust it |
||
if (this.wereTabsClickedRecently(this.LEARNERS_TABS_ID)) { | ||
this.$nextTick(() => { | ||
this.$refs.tabList.focusActiveTab(); | ||
}); | ||
} | ||
}, | ||
$trs: { | ||
back: { | ||
message: 'All learners', | ||
context: | ||
"Link that takes user back to the list of learners on the 'Reports' tab, from the individual learner's information page.", | ||
}, | ||
reportLearners: { | ||
message: 'Report learners', | ||
context: 'Labels the Reports > Learners tab for screen reander users', | ||
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. A little typo: "...screen reader" |
||
}, | ||
}, | ||
}; | ||
|
||
|
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.
Just a nitpick, no change required. May be nice to follow the naming convention of other constants and use
'coachReportsLearners'
as ID value.