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

Issue 10254: Improve coach tabs accessibility of Reports Lesson Tab #11606

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
9 changes: 7 additions & 2 deletions kolibri/plugins/coach/assets/src/constants/tabsConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const ReportsGroupTabs = {
ACTIVITY: 'tabActivity',
};

export const LEARNERS_TABS_ID = 'reportLearners';
export const LearnersTabs = {
export const REPORTS_LEARNERS_TABS_ID = 'coachReportsLearners';
export const ReportsLearnersTabs = {
REPORTS: 'tabReports',
ACTIVITY: 'tabActivity',
};
Expand All @@ -31,3 +31,8 @@ export const QuizzesTabs = {
REPORT: 'tabReport',
DIFFICULT_QUESTIONS: 'tabDifficultQuestions',
};
export const REPORTS_LESSON_TABS_ID = 'coachReportsLesson';
export const ReportsLessonTabs = {
REPORTS: 'tabReports',
LEARNERS: 'tabLearners',
};
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,10 @@ const coachStrings = createTranslator('CommonCoachStrings', {
context:
'Indicates to the coach how many questions the learner answered correctly compared to the previous attempt',
},
coachReportsLesson: {
message: 'Report lesson',
context: 'Labels the Reports > Lesson tab for screen reader users',
},
});

// Strings for the Missing Content modals, tooltips, alerts, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<KPageContainer>

<ReportsLearnerHeader :enablePrint="true" :activeTabId="LearnersTabs.ACTIVITY" />
<ReportsLearnerHeader :enablePrint="true" :activeTabId="ReportsLearnersTabs.ACTIVITY" />
<KTabsPanel
:tabsId="LEARNERS_TABS_ID"
:activeTabId="LearnersTabs.ACTIVITY"
:tabsId="REPORTS_LEARNERS_TABS_ID"
:activeTabId="ReportsLearnersTabs.ACTIVITY"
>
<ActivityList
embeddedPageName="ReportsLearnerActivityPage"
Expand All @@ -29,7 +29,7 @@
import commonCoach from '../common';
import CoachAppBarPage from '../CoachAppBarPage';
import ActivityList from '../common/notifications/ActivityList';
import { LEARNERS_TABS_ID, LearnersTabs } from '../../constants/tabsConstants';
import { REPORTS_LEARNERS_TABS_ID, ReportsLearnersTabs } from '../../constants/tabsConstants';
import ReportsLearnerHeader from './ReportsLearnerHeader';

export default {
Expand All @@ -42,8 +42,8 @@
mixins: [commonCoach],
data() {
return {
LEARNERS_TABS_ID,
LearnersTabs,
REPORTS_LEARNERS_TABS_ID,
ReportsLearnersTabs,
};
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
<HeaderTabs :enablePrint="enablePrint">
<KTabsList
ref="tabList"
:tabsId="LEARNERS_TABS_ID"
:tabsId="REPORTS_LEARNERS_TABS_ID"
:ariaLabel="$tr('reportLearners')"
:activeTabId="activeTabId"
:tabs="tabs"
@click="() => saveTabsClick(LEARNERS_TABS_ID)"
@click="() => saveTabsClick(REPORTS_LEARNERS_TABS_ID)"
/>
</HeaderTabs>
</div>
Expand All @@ -71,7 +71,7 @@

import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import commonCoach from '../common';
import { LEARNERS_TABS_ID, LearnersTabs } from '../../constants/tabsConstants';
import { REPORTS_LEARNERS_TABS_ID, ReportsLearnersTabs } from '../../constants/tabsConstants';
import { useCoachTabs } from '../../composables/useCoachTabs';

export default {
Expand All @@ -97,7 +97,7 @@
},
data() {
return {
LEARNERS_TABS_ID,
REPORTS_LEARNERS_TABS_ID,
};
},
computed: {
Expand Down Expand Up @@ -136,12 +136,12 @@
tabs() {
return [
{
id: LearnersTabs.REPORTS,
id: ReportsLearnersTabs.REPORTS,
label: this.coachString('reportsLabel'),
to: this.classRoute('ReportsLearnerReportPage', {}),
},
{
id: LearnersTabs.ACTIVITY,
id: ReportsLearnersTabs.ACTIVITY,
label: this.coachString('activityLabel'),
to: this.classRoute('ReportsLearnerActivityPage', {}),
},
Expand All @@ -153,8 +153,8 @@
// 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)
if (this.wereTabsClickedRecently(this.LEARNERS_TABS_ID)) {
// when visiting the page for the first time)
if (this.wereTabsClickedRecently(this.REPORTS_LEARNERS_TABS_ID)) {
this.$nextTick(() => {
this.$refs.tabList.focusActiveTab();
});
Expand All @@ -168,7 +168,7 @@
},
reportLearners: {
message: 'Report learners',
context: 'Labels the Reports > Learners tab for screen reander users',
context: 'Labels the Reports > Learners tab for screen reader users',
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<KPageContainer>

<ReportsLearnerHeader :activeTabId="LearnersTabs.REPORTS" />
<ReportsLearnerHeader :activeTabId="ReportsLearnersTabs.REPORTS" />
<KTabsPanel
:tabsId="LEARNERS_TABS_ID"
:activeTabId="LearnersTabs.REPORTS"
:tabsId="REPORTS_LEARNERS_TABS_ID"
:activeTabId="ReportsLearnersTabs.REPORTS"
>
<ReportsControls :disableExport="true" />

Expand Down Expand Up @@ -102,7 +102,7 @@
import commonCoach from '../common';
import CoachAppBarPage from '../CoachAppBarPage';
import { PageNames } from '../../constants';
import { LEARNERS_TABS_ID, LearnersTabs } from '../../constants/tabsConstants';
import { REPORTS_LEARNERS_TABS_ID, ReportsLearnersTabs } from '../../constants/tabsConstants';
import ReportsLearnerHeader from './ReportsLearnerHeader';
import ReportsControls from './ReportsControls';

Expand All @@ -116,8 +116,8 @@
mixins: [commonCoach, commonCoreStrings],
data() {
return {
LEARNERS_TABS_ID,
LearnersTabs,
REPORTS_LEARNERS_TABS_ID,
ReportsLearnersTabs,
};
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,13 @@
<KPageContainer :topMargin="$isPrint ? 0 : 24">
<ReportsControls @export="exportCSV" />
<HeaderTabs :enablePrint="true">
<HeaderTab
:text="coachString('reportLabel')"
:to="group ?
classRoute('ReportsGroupReportLessonPage') :
classRoute('ReportsLessonReportPage')"
/>
<HeaderTab
:text="coreString('learnersLabel')"
:to="group ?
classRoute('ReportsGroupReportLessonLearnerListPage') :
classRoute('ReportsLessonLearnerListPage')"
<KTabsList
ref="tabList"
:tabsId="REPORTS_LESSON_TABS_ID"
:ariaLabel="coachReportsLesson$()"
:activeTabId="activeTabId"
:tabs="tabs"
@click="() => saveTabsClick(REPORTS_LESSON_TABS_ID)"
/>
</HeaderTabs>
<ReportsLessonResourcesList
Expand All @@ -75,10 +71,13 @@
import sortBy from 'lodash/sortBy';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import commonCoach from '../common';
import { coachStrings } from '../common/commonCoachStrings';
import CoachAppBarPage from '../CoachAppBarPage';
import CSVExporter from '../../csv/exporter';
import * as csvFields from '../../csv/fields';
import LessonOptionsDropdownMenu from '../plan/LessonSummaryPage/LessonOptionsDropdownMenu';
import { REPORTS_LESSON_TABS_ID, ReportsLessonTabs } from '../../constants/tabsConstants';
import { useCoachTabs } from '../../composables/useCoachTabs';
import ReportsControls from './ReportsControls';
import ReportsLessonLearnersList from './ReportsLessonLearnersList';
import ReportsLessonResourcesList from './ReportsLessonResourcesList';
Expand All @@ -93,6 +92,15 @@
ReportsLessonResourcesList,
},
mixins: [commonCoach, commonCoreStrings],
setup() {
const { coachReportsLesson$ } = coachStrings;
const { saveTabsClick, wereTabsClickedRecently } = useCoachTabs();
return {
saveTabsClick,
wereTabsClickedRecently,
coachReportsLesson$,
};
},
props: {
showResources: {
type: Boolean,
Expand All @@ -102,6 +110,15 @@
type: Boolean,
default: false,
},
activeTabId: {
type: String,
required: true,
},
},
data() {
return {
REPORTS_LESSON_TABS_ID,
};
},
computed: {
lesson() {
Expand Down Expand Up @@ -151,6 +168,36 @@
return tableRow;
});
},
tabs() {
return [
{
id: ReportsLessonTabs.REPORTS,
label: this.coachString('reportsLabel'),
to: this.group
? this.classRoute('ReportsGroupReportLessonPage')
: this.classRoute('ReportsLessonReportPage'),
},
{
id: ReportsLessonTabs.LEARNERS,
label: this.coachString('learnersLabel'),
to: this.group
? this.classRoute('ReportsGroupReportLessonLearnerListPage')
: this.classRoute('ReportsLessonLearnerListPage'),
},
];
},
},
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 page for the first time)
if (this.wereTabsClickedRecently(this.REPORTS_LESSON_TABS_ID)) {
this.$nextTick(() => {
this.$refs.tabList.focusActiveTab();
});
}
},
methods: {
handleSelectOption(action) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<template>

<ReportsLessonBase :showLearners="true" />
<ReportsLessonBase :showLearners="true" :activeTabId="ReportsLessonTabs.LEARNERS">
<KTabPanel :tabsId="REPORTS_LESSON_TABS_ID" :activeTabId="ReportsLessonTabs.LEARNERS" />
</ReportsLessonBase>

</template>


<script>

import { REPORTS_LESSON_TABS_ID, ReportsLessonTabs } from '../../constants/tabsConstants';
import ReportsLessonBase from './ReportsLessonBase';

export default {
name: 'ReportsLessonLearnerListPage',
components: {
ReportsLessonBase,
},
data() {
return {
REPORTS_LESSON_TABS_ID,
ReportsLessonTabs,
};
},
};

</script>
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<template>

<ReportsLessonBase :showResources="true" />
<ReportsLessonBase :showResources="true" :activeTabId="ReportsLessonTabs.REPORTS">
<KTabPanel :tabsId="REPORTS_LESSON_TABS_ID" :activeTabId="ReportsLessonTabs.REPORTS" />
</ReportsLessonBase>

</template>


<script>

import { REPORTS_LESSON_TABS_ID, ReportsLessonTabs } from '../../constants/tabsConstants';
import ReportsLessonBase from './ReportsLessonBase';

export default {
name: 'ReportsLessonReportPage',
components: {
ReportsLessonBase,
},
data() {
return {
REPORTS_LESSON_TABS_ID,
ReportsLessonTabs,
};
},
};

</script>
Loading