Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed Mar 3, 2022
1 parent af4a5ca commit 2a3f0f3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/organisms/OcModal/OcModal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="oc-modal-background" aria-labelledby="oc-modal-title">
<focus-trap :active="true" :initial-focus="focusTrapInitial || getInitialFocusRef">
<focus-trap :active="true" :initial-focus="getInitialFocusRef">
<div
ref="ocModal"
:class="classes"
Expand Down Expand Up @@ -246,6 +246,14 @@ export default {
}
},
computed: {
getInitialFocusRef() {
if (this.focusTrapInitial) {
return this.focusTrapInitial
}
return () => {
return this.$refs.ocModalInput || this.$refs.ocModal
}
},
classes() {
return ["oc-modal", `oc-modal-${this.variation}`]
},
Expand Down Expand Up @@ -285,9 +293,6 @@ export default {
inputAssignPropAsValue(value) {
this.userInputValue = value
},
getInitialFocusRef() {
return this.$refs.ocModalInput || this.$refs.ocModal
},
},
}
</script>
Expand Down

0 comments on commit 2a3f0f3

Please sign in to comment.