Skip to content

Commit

Permalink
replace FocusTrap in favour of KFocusTrap
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh-sagi125 authored and rtibbles committed Nov 6, 2024
1 parent 7fffa44 commit 3654ae8
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 178 deletions.
2 changes: 0 additions & 2 deletions kolibri/core/assets/src/core-app/apiSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import Draggable from '../views/sortable/Draggable';
import DragHandle from '../views/sortable/DragHandle';
import DragContainer from '../views/sortable/DragContainer';
import DragSortWidget from '../views/sortable/DragSortWidget';
import FocusTrap from '../views/FocusTrap';
import BottomAppBar from '../views/BottomAppBar';
import BaseToolbar from '../views/BaseToolbar';
import GenderSelect from '../views/userAccounts/GenderSelect';
Expand Down Expand Up @@ -169,7 +168,6 @@ export default {
DragHandle,
DragContainer,
DragSortWidget,
FocusTrap,
BottomAppBar,
BaseToolbar,
GenderSelect,
Expand Down
8 changes: 2 additions & 6 deletions kolibri/core/assets/src/views/CoreMenu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
<slot name="header"></slot>
</div>

<FocusTrap
<KFocusTrap
ref="focusTrap"
class="ui-menu-options"
:disabled="!containFocus"
@shouldFocusFirstEl="$emit('shouldFocusFirstEl')"
@shouldFocusLastEl="focusLastEl"
>
<slot name="options"></slot>
</FocusTrap>
</KFocusTrap>

<div
v-if="$slots.footer"
Expand All @@ -42,13 +42,9 @@
<script>
import last from 'lodash/last';
import FocusTrap from 'kolibri.coreVue.components.FocusTrap';
export default {
name: 'CoreMenu',
components: {
FocusTrap,
},
props: {
// Whether to show if links are currently active
showActive: {
Expand Down
78 changes: 0 additions & 78 deletions kolibri/core/assets/src/views/FocusTrap.vue

This file was deleted.

6 changes: 2 additions & 4 deletions kolibri/core/assets/src/views/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
backgroundColor: $themeTokens.surface,
}"
>
<FocusTrap
<KFocusTrap
@shouldFocusFirstEl="$emit('shouldFocusFirstEl')"
@shouldFocusLastEl="focusLastEl"
>
Expand Down Expand Up @@ -214,7 +214,7 @@
:style="{ color: $themeTokens.text }"
>{{ sideNavTitleText }}</span>
</div>
</FocusTrap>
</KFocusTrap>
</div>
</transition>

Expand Down Expand Up @@ -269,7 +269,6 @@
import TotalPoints from './TotalPoints.vue';
import SyncStatusDisplay from './SyncStatusDisplay';
import SideNavDivider from './SideNavDivider';
import FocusTrap from './FocusTrap.vue';
import BottomNavigationBar from './BottomNavigationBar';
// Explicit ordered list of roles for nav item sorting
Expand All @@ -293,7 +292,6 @@
SyncStatusDisplay,
SideNavDivider,
PrivacyInfoModal,
FocusTrap,
TotalPoints,
LanguageSwitcherModal,
BottomNavigationBar,
Expand Down
58 changes: 0 additions & 58 deletions kolibri/core/assets/src/views/__tests__/FocusTrap.spec.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<FocusTrap
<KFocusTrap
@shouldFocusFirstEl="focusFirstEl"
@shouldFocusLastEl="focusLastEl"
>
Expand Down Expand Up @@ -36,7 +36,7 @@
</KRadioButtonGroup>
</KGrid>
</KModal>
</FocusTrap>
</KFocusTrap>

</template>

Expand All @@ -46,12 +46,10 @@
import { currentLanguage } from 'kolibri.utils.i18n';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import FocusTrap from 'kolibri.coreVue.components.FocusTrap';
import languageSwitcherMixin from './mixin';
export default {
name: 'LanguageSwitcherModal',
components: { FocusTrap },
mixins: [commonCoreStrings, languageSwitcherMixin],
setup() {
const { windowIsSmall } = useKResponsiveWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,21 @@
</AccordionContainer>
</div>
</KTabsPanel>
<FocusTrap>
<KModal
v-if="showDeleteConfirmation"
:title="deleteSectionLabel$()"
:submitText="coreString('deleteAction')"
:cancelText="coreString('cancelAction')"
@cancel="showDeleteConfirmation = false"
@submit="handleConfirmDelete"
>
{{
deleteConfirmation$({
section_title: displaySectionTitle(activeSection, activeSectionIndex),
})
}}
</KModal>
</FocusTrap>

<KModal
v-if="showDeleteConfirmation"
:title="deleteSectionLabel$()"
:submitText="coreString('deleteAction')"
:cancelText="coreString('cancelAction')"
@cancel="showDeleteConfirmation = false"
@submit="handleConfirmDelete"
>
{{
deleteConfirmation$({
section_title: displaySectionTitle(activeSection, activeSectionIndex),
})
}}
</KModal>
</div>

</template>
Expand All @@ -328,7 +327,6 @@
import { MAX_QUESTIONS_PER_QUIZ_SECTION } from 'kolibri.coreVue.vuex.constants';
import AccordionItem from 'kolibri-common/components/accordion/AccordionItem';
import AccordionContainer from 'kolibri-common/components/accordion/AccordionContainer';
import FocusTrap from 'kolibri.coreVue.components.FocusTrap';
import useSnackbar from 'kolibri.coreVue.composables.useSnackbar';
import { injectQuizCreation } from '../../../composables/useQuizCreation';
import commonCoach from '../../common';
Expand All @@ -348,7 +346,6 @@
DragSortWidget,
DragHandle,
TabsWithOverflow,
FocusTrap,
},
mixins: [commonCoreStrings, commonCoach],
setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
aria-labelledby="modal-title"
:style="[modalSizeStyles, { background: $themeTokens.surface }]"
>
<FocusTrap
<KFocusTrap
@shouldFocusFirstEl="$emit('shouldFocusFirstEl')"
@shouldFocusLastEl="focusLastEl"
>
Expand Down Expand Up @@ -142,7 +142,7 @@
:tooltip="coreString('closeAction')"
@click="$emit('close')"
/>
</FocusTrap>
</KFocusTrap>
</div>
</div>
</transition>
Expand All @@ -155,7 +155,6 @@
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import UiAlert from 'kolibri-design-system/lib/keen/UiAlert';
import { MaxPointsPerContent } from 'kolibri.coreVue.vuex.constants';
import FocusTrap from 'kolibri.coreVue.components.FocusTrap';
import { ContentNodeResource } from 'kolibri.resources';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import useUser from 'kolibri.coreVue.composables.useUser';
Expand All @@ -180,7 +179,6 @@
export default {
name: 'CompletionModal',
components: {
FocusTrap,
CompletionModalSection,
ResourceItem,
UiAlert,
Expand Down
6 changes: 2 additions & 4 deletions packages/kolibri-common/components/SidePanelModal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@keyup.esc="closePanel"
>
<transition name="side-panel">
<FocusTrap
<KFocusTrap
@shouldFocusFirstEl="$emit('shouldFocusFirstEl')"
@shouldFocusLastEl="focusLastEl"
>
Expand Down Expand Up @@ -45,7 +45,7 @@
<slot></slot>
</div>
</section>
</FocusTrap>
</KFocusTrap>
</transition>

<Backdrop
Expand All @@ -64,13 +64,11 @@
import Backdrop from 'kolibri.coreVue.components.Backdrop';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import FocusTrap from 'kolibri.coreVue.components.FocusTrap';
export default {
name: 'SidePanelModal',
components: {
Backdrop,
FocusTrap,
},
mixins: [commonCoreStrings],
setup() {
Expand Down

0 comments on commit 3654ae8

Please sign in to comment.