Permalink
Browse files

fix(form-textarea): Set width to 100% if in plaintext mode

Maintains the form-control width in `plaintext` mode

Added a `noResize` prop to allow user to stop text area from being resized
  • Loading branch information...
tmorehouse committed Sep 2, 2017
1 parent 9db37c4 commit 01735e68d791987a57f0e662e8fba7a944e8bd33
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/components/form-textarea.vue
@@ -1,6 +1,7 @@
<template>
<textarea v-model="localValue"
:class="inputClass"
:style="inputStyle"
:id="safeId()"
:name="name"
:disabled="disabled"
@@ -61,6 +62,10 @@
// 'soft', 'hard' or 'off'. Browser default is 'soft'
type: String,
default: 'soft'
},
noResize: {
type: Boolean,
default: false
}
},
computed: {
@@ -76,6 +81,14 @@
this.stateClass
];
},
inputStyle() {
// We set width 100% in plaintext mode to get around a shortcoming in bootstrap CSS
// setting noResize to true will disable the ability for the user to resize the textarea
return {
width: this.plaintext ? '100%' : null,
resize: this.noResize ? 'false' : null
};
},
computedAriaInvalid() {
if (!Boolean(this.ariaInvalid) || this.ariaInvalid === 'false') {
// this.ariaInvalid is null or false or 'false'
@@ -85,7 +98,7 @@
// User wants explicit aria-invalid=true
return 'true';
}
// Most likely a string value (which could be 'true')
// Most likely a string value (which could be the string 'true')
return this.ariaInvalid;
}
},

0 comments on commit 01735e6

Please sign in to comment.