coreui-vue icon indicating copy to clipboard operation
coreui-vue copied to clipboard

In the form control wrapper wrap the elements inside a <div>

Open gfoidl opened this issue 3 years ago • 4 comments
trafficstars

Without wrapping inside a <div> the valiation feedback may be shown on other input-controls too, which is not intended. Thus we need to wrap all controls related to the input inside a div, in order to scope the style to it.

gfoidl avatar May 06 '22 09:05 gfoidl

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Aug 08 '22 14:08 github-actions[bot]

Please don't close, mege instead 😉

gfoidl avatar Aug 08 '22 14:08 gfoidl

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Oct 08 '22 14:10 github-actions[bot]

Please don't close, mege instead 😉

Still the same.

gfoidl avatar Oct 08 '22 14:10 gfoidl

@gfoidl Without wrapping inside a div the valiation feedback may be shown on other input-controls too, which is not intended. Can you show me an example?

mrholek avatar Oct 18 '22 17:10 mrholek

From https://playcode.io/988904

grafik

The seconds input has no invalid set, also the red border isn't shown. But the feedbackInvalid is shown, which is wrong. This PR corrects that behavior.

It has to do on how bootstrap validation rules are specified in CSS.

gfoidl avatar Oct 18 '22 18:10 gfoidl

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Dec 20 '22 14:12 github-actions[bot]

Dear bot, don't close and disable yourself.

gfoidl avatar Dec 20 '22 14:12 gfoidl

@gfoidl I just checked it and an additional div breaks <CInputGroup /> layout.

mrholek avatar Jan 17 '23 00:01 mrholek

Then this should be fixed (too). In https://github.com/coreui/coreui-vue/pull/209#issuecomment-1282798171 when the <div>s are removed it's wrong behavior.

For my use I fixed this locally, and there's also a <CInputGroup /> -- the layout is correct and not broken. Bootstrap didn't change in how the validation rules are specified, so a wrapper div for the inputs is needed.

gfoidl avatar Jan 17 '23 09:01 gfoidl

@gfoidl please check this css

.input-group > .form-control,
.input-group > .form-select,
.input-group > .form-floating {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
}
.input-group > .form-control:focus,
.input-group > .form-select:focus,
.input-group > .form-floating:focus-within {
  z-index: 5;
}

if we add an additional div, then we will have something like that .input-group > div instead of .input-group >.form-control

mrholek avatar Jan 17 '23 12:01 mrholek

Yep, that's right.

But

<script setup>
  import { ref, computed } from 'vue'

  const name = ref("");
  const age = ref();
</script>

<template>
  <CForm novalidate>
    <CFormInput label="Name" :value="name" feedbackInvalid="Name must be entered" invalid />
    <!-- Note no 'invalid' given here-->
    <CFormInput label="Age" :value="age" type="number" feedbackInvalid="Age must be given" />
  </CForm>
</template>

<style>
  form {
    width: 60%;
    margin: 1rem;
  }
</style>

Will show the feedbackInvalid on the second input where it should not be shown. How would solve that issue otherwise?

gfoidl avatar Jan 17 '23 14:01 gfoidl

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Mar 18 '23 14:03 github-actions[bot]