Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(VDialog): make form fill parent #20555

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

Jesse205
Copy link
Contributor

@Jesse205 Jesse205 commented Oct 3, 2024

Description

When VDialog specifies height and is used with a form, the dialog does not display the correct height as expected.

Because this pr makes the form completely populate the parent element, there is no need to #20417

Markup:

<template>
  <v-app>
    <v-container>
      <div class="pa-4 text-center">
        <v-dialog
          v-model="dialog"
          :fullscreen="isFullscreen"
          scrollable
          :width="!isFullscreen ? 600 : undefined"
          :height="!isFullscreen ? 600 : undefined"
          :max-width="!isFullscreen ? 600 : undefined"
          :max-height="!isFullscreen ? 600 : undefined"
        >
          <template v-slot:activator="{ props: activatorProps }">
            <v-btn
              class="text-none font-weight-regular"
              text="Edit Profile"
              variant="tonal"
              v-bind="activatorProps"
            ></v-btn>
          </template>
          <form>
            <v-card>
              <v-card-item>
                <v-card-title style="display: flex">
                  <span>User Profile</span>
                  <v-spacer />
                  <v-btn
                    :icon="
                      isFullscreen ? 'mdi-fullscreen-exit' : 'mdi-fullscreen'
                    "
                    variant="text"
                    @click="isFullscreen = !isFullscreen"
                  ></v-btn>
                </v-card-title>
              </v-card-item>
              <v-card-text>
                <v-row dense>
                  <v-col cols="12" md="4" sm="6">
                    <v-text-field label="First name*" required></v-text-field>
                  </v-col>

                  <v-col cols="12" md="4" sm="6">
                    <v-text-field
                      hint="example of helper text only on focus"
                      label="Middle name"
                    ></v-text-field>
                  </v-col>

                  <v-col cols="12" md="4" sm="6">
                    <v-text-field
                      hint="example of persistent helper text"
                      label="Last name*"
                      persistent-hint
                      required
                    ></v-text-field>
                  </v-col>

                  <v-col cols="12" md="4" sm="6">
                    <v-text-field label="Email*" required></v-text-field>
                  </v-col>

                  <v-col cols="12" md="4" sm="6">
                    <v-text-field
                      label="Password*"
                      type="password"
                      required
                    ></v-text-field>
                  </v-col>

                  <v-col cols="12" md="4" sm="6">
                    <v-text-field
                      label="Confirm Password*"
                      type="password"
                      required
                    ></v-text-field>
                  </v-col>

                  <v-col cols="12" sm="6">
                    <v-select
                      :items="['0-17', '18-29', '30-54', '54+']"
                      label="Age*"
                      required
                    ></v-select>
                  </v-col>

                  <v-col cols="12" sm="6">
                    <v-autocomplete
                      :items="[
                        'Skiing',
                        'Ice hockey',
                        'Soccer',
                        'Basketball',
                        'Hockey',
                        'Reading',
                        'Writing',
                        'Coding',
                        'Basejump',
                      ]"
                      label="Interests"
                      auto-select-first
                      multiple
                    ></v-autocomplete>
                  </v-col>
                </v-row>

                <small class="text-caption text-medium-emphasis"
                  >*indicates required field</small
                >
              </v-card-text>

              <v-divider></v-divider>

              <v-card-actions>
                <v-spacer></v-spacer>

                <v-btn
                  text="Close"
                  variant="plain"
                  @click="dialog = false"
                ></v-btn>

                <v-btn
                  color="primary"
                  text="Save"
                  variant="tonal"
                  @click="dialog = false"
                ></v-btn>
              </v-card-actions>
            </v-card>
          </form>
        </v-dialog>
      </div>
    </v-container>
  </v-app>
</template>

<script setup>
import { ref } from "vue";

const dialog = ref(true);
const isFullscreen = ref(false);
</script>

@Jesse205 Jesse205 marked this pull request as draft October 3, 2024 20:58
@Jesse205 Jesse205 force-pushed the fix-dialog-form-fill branch from 241e6f2 to df415a2 Compare October 3, 2024 21:03
@Jesse205 Jesse205 marked this pull request as ready for review October 3, 2024 21:04
@Jesse205 Jesse205 force-pushed the fix-dialog-form-fill branch from df415a2 to 8b15436 Compare October 13, 2024 08:08
@MajesticPotatoe MajesticPotatoe added T: bug Functionality that does not work as intended/expected C: VDialog VDialog labels Oct 28, 2024
@KaelWD KaelWD added this to the v3.7.x milestone Nov 6, 2024
@KaelWD KaelWD changed the title fix(VDialog): make form fill parent in dialog fix(VDialog): make form fill parent Nov 6, 2024
@KaelWD KaelWD merged commit 42a12dd into vuetifyjs:master Nov 6, 2024
2 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C: VDialog VDialog T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants