Skip to content

Commit

Permalink
fix: scrollbar is always visible in resizable textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeUrSelf committed Dec 23, 2024
1 parent 7fae1d2 commit 66d391f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions resources/js/Helpers/vDynamicTextAreaHeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function initDynamicHeightCalc(input: HTMLTextAreaElement & { _calculateDynamicH

input._calculateDynamicHeight()
input.style.resize = 'none'
input.style.overflowY = 'hidden'
}

function calculateDynamicHeight(input: HTMLTextAreaElement, binding?: DirectiveBinding<boolean>){
Expand All @@ -26,10 +27,10 @@ function removeDynamicHeightCalc(input: HTMLTextAreaElement & { _calculateDynami
input.removeEventListener('transitionend', input._calculateDynamicHeight)
}

const vDynamicInputHeight = {
const vDynamicTextAreaHeight = {
mounted: initDynamicHeightCalc,
updated: calculateDynamicHeight,
unmounted: removeDynamicHeightCalc,
}

export default vDynamicInputHeight
export default vDynamicTextAreaHeight
4 changes: 2 additions & 2 deletions resources/js/components/QuizzesPanel/AnswerComponent.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import CheckDynamicIcon from '@/components/Icons/CheckDynamicIcon.vue'
import vDynamicInputHeight from '@/Helpers/vDynamicTextAreaHeight'
import vDynamicTextAreaHeight from '@/Helpers/vDynamicTextAreaHeight'
import { XMarkIcon } from '@heroicons/vue/24/outline'
defineProps<{ editing: boolean }>()
Expand Down Expand Up @@ -30,7 +30,7 @@ const emit = defineEmits<{ delete: [answer:Answer], setCorrect: [answer:Answer]}
<textarea
v-else
v-model="answer.text"
v-dynamic-input-height
v-dynamic-text-area-height
placeholder="Wpisz odpowiedź"
class="h-12 w-full p-2 bg-transparent outline-none border-b border-primary/30 focus:border-primary/60"
/>
Expand Down

0 comments on commit 66d391f

Please sign in to comment.