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

[Bug]: textarea widget doesn't support :v-model binding like classical vue #72

Closed
maelp opened this issue Sep 22, 2023 · 7 comments
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@maelp
Copy link

maelp commented Sep 22, 2023

Environment

Developement/Production OS: Windows 10 19043.1110
Node version: 16.0.0
Package manager: pnpm@8.6.0
Radix Vue version: 1.0.0
Shadcn Vue version: 1.0.0
Vue version: 3.0.0
Nuxt version: 3.0.0
Nuxt mode: universal
Nuxt target: server
CSS framework: tailwindcss@3.3.3
Client OS: Windows 10 19043.1110
Browser: Chrome 90.0.4430.212

Link to minimal reproduction

none

Steps to reproduce

This is how to fix it

<script setup lang="ts">
import { defineProps, defineEmits } from "vue";
import { cn } from "../frameworkUtils";

const props = defineProps(["modelValue"]);
const emits = defineEmits(["update:modelValue"]);

const onInput = (event: Event) => {
  const value = (event.target as HTMLTextAreaElement).value;
  emits("update:modelValue", value);
};
</script>

<template>
  <textarea
    :value="props.modelValue"
    @input="onInput"
    :class="
      cn(
        'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
        $attrs.class ?? ''
      )
    "
  ></textarea>
</template>

Describe the bug

Otherwise doing a <Textarea v-model="someRef" /> will not work

Expected behavior

No response

Conext & Screenshots (if applicable)

No response

@maelp maelp added the bug Something isn't working label Sep 22, 2023
@zernonia
Copy link
Contributor

Thanks for the provided fix @maelp ! I realize Textarea for default is not as complete as new-york style. And we prefer using useVModel to standardize the usage of v-model.

This should be simple fix 😁

@zernonia zernonia added the good first issue Good for newcomers label Sep 24, 2023
@maelp
Copy link
Author

maelp commented Sep 24, 2023

ah nice ! the widgets are different in both versions? then we might perhaps review them to have equivalent features?

@maelp
Copy link
Author

maelp commented Sep 24, 2023

Also I'm using the Popover and tooltip and other hover items from the "standard" lib (not new-york") and there are small bugs like:

  • if it opens near an edge of the screen, it goes out of the screen (rather than staying at most at left=0 or right=0 to be completely in screen)
  • similarly, if it opens near the bottom, the popover / tooltip / dropdown / select still opens below the widget (and therefore goes out of the screen) rather than opening on top (like it does in the radix-vue demo site)

is that a bug with the standard implementation? is it fixed in new-yrok? or should we work on a fix?

@ahmedmayara
Copy link
Collaborator

There's a prop called avoidCollisions I guess that this prop is not set to true by default in both styles (new-york and default). It's a simple fix you can open an issue and fix it if you want to.

@maelp
Copy link
Author

maelp commented Sep 24, 2023

Done (BTW did we fix the textarea in standard?)

@ahmedmayara
Copy link
Collaborator

ahmedmayara commented Sep 24, 2023

The <Combobox /> component is built using a composition of the <Popover /> and the <Command /> components. That's why it is not implemented as seperate component in the registry folder.

@ahmedmayara
Copy link
Collaborator

Yes, the <Textarea /> component is fixed. I already did that so that's why I closed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants