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

Revert breaking change in autocomplete prop of Taginput #414

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ export default defineComponent({
default: () => ['Tab', 'Enter']
},
selectableHeader: Boolean,
selectableFooter: Boolean
selectableFooter: Boolean,
// Native options to use in HTML5 validation
autocomplete: String
},
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`BClockpicker > render correctly 1`] = `
"<div class=\\"b-clockpicker control is-primary\\">
<div class=\\"dropdown dropdown-menu-animation is-mobile-modal\\">
<div tabindex=\\"0\\" class=\\"dropdown-trigger\\" aria-haspopup=\\"true\\">
<b-input-stub type=\\"text\\" lazy=\\"false\\" passwordreveal=\\"false\\" iconclickable=\\"false\\" hascounter=\\"true\\" customclass=\\"\\" iconrightclickable=\\"false\\" autocomplete=\\"off\\" loading=\\"false\\" readonly=\\"\\" rounded=\\"false\\" use-html5-validation=\\"true\\"></b-input-stub>
<b-input-stub autocomplete=\\"off\\" type=\\"text\\" lazy=\\"false\\" passwordreveal=\\"false\\" iconclickable=\\"false\\" hascounter=\\"true\\" customclass=\\"\\" iconrightclickable=\\"false\\" loading=\\"false\\" readonly=\\"\\" rounded=\\"false\\" use-html5-validation=\\"true\\"></b-input-stub>
</div>
<transition-stub name=\\"fade\\" appear=\\"false\\" persisted=\\"false\\" css=\\"true\\">
<div class=\\"background\\" aria-hidden=\\"true\\" style=\\"display: none;\\"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`BDatepicker > render correctly 1`] = `
"<div class=\\"datepicker control\\">
<div class=\\"dropdown dropdown-menu-animation is-mobile-modal\\">
<div tabindex=\\"-1\\" class=\\"dropdown-trigger\\" aria-haspopup=\\"true\\">
<b-input-stub type=\\"text\\" lazy=\\"false\\" passwordreveal=\\"false\\" iconclickable=\\"false\\" hascounter=\\"true\\" customclass=\\"\\" iconrightclickable=\\"false\\" autocomplete=\\"off\\" rounded=\\"false\\" loading=\\"false\\" readonly=\\"\\" use-html5-validation=\\"false\\"></b-input-stub>
<b-input-stub autocomplete=\\"off\\" type=\\"text\\" lazy=\\"false\\" passwordreveal=\\"false\\" iconclickable=\\"false\\" hascounter=\\"true\\" customclass=\\"\\" iconrightclickable=\\"false\\" rounded=\\"false\\" loading=\\"false\\" readonly=\\"\\" use-html5-validation=\\"false\\"></b-input-stub>
</div>
<transition-stub name=\\"fade\\" appear=\\"false\\" persisted=\\"false\\" css=\\"true\\">
<div class=\\"background\\" aria-hidden=\\"true\\" style=\\"display: none;\\"></div>
Expand Down
4 changes: 3 additions & 1 deletion packages/buefy-next/src/components/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export default defineComponent({
},
iconRight: String,
iconRightClickable: Boolean,
iconRightType: String
iconRightType: String,
// Native options to use in HTML5 validation
autocomplete: String
},
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ export default defineComponent({
longPress: {
type: Boolean,
default: true
}
},
// Native options to use in HTML5 validation
autocomplete: String
},
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('BTaginput', () => {
let firedFooter = false
const wrapper = mount(BTaginput, {
props: {
autocomplete: '', // equivalent to attribute without value
autocomplete: true,
iconRight: 'close-circle',
iconRightClickable: true,
selectableHeader: true,
Expand Down
7 changes: 4 additions & 3 deletions packages/buefy-next/src/components/taginput/Taginput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default defineComponent({
type: String,
default: 'value'
},
autocomplete: Boolean,
groupField: String,
groupOptions: String,
nativeAutocomplete: String,
Expand Down Expand Up @@ -310,7 +311,7 @@ export default defineComponent({
const tagToAdd: U = tag || this.newTag.trim()

if (tagToAdd) {
if (!(this.autocomplete || this.autocomplete === '')) {
if (!this.autocomplete) {
const reg = this.separatorsAsRegExp
// TODO: won't work if `tagToAdd` is not a string
if (reg && tagToAdd.match(reg)) {
Expand Down Expand Up @@ -351,7 +352,7 @@ export default defineComponent({

customOnBlur(event: Event) {
// Add tag on-blur if not select only
if (!(this.autocomplete || this.autocomplete === '')) this.addTag()
if (!this.autocomplete) this.addTag()

this.onBlur(event)
},
Expand Down Expand Up @@ -388,7 +389,7 @@ export default defineComponent({
this.removeLastTag()
}
// Stop if is to accept select only
if ((this.autocomplete || this.autocomplete === '') && !this.allowNew) return
if (this.autocomplete && !this.allowNew) return

if (this.confirmKeys.indexOf(key) >= 0) {
// Allow Tab to advance to next field regardless
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`BTimepicker > render correctly 1`] = `
"<div class=\\"timepicker control\\">
<div class=\\"dropdown dropdown-menu-animation is-mobile-modal\\">
<div tabindex=\\"0\\" class=\\"dropdown-trigger\\" aria-haspopup=\\"true\\">
<b-input-stub type=\\"text\\" lazy=\\"false\\" passwordreveal=\\"false\\" iconclickable=\\"false\\" hascounter=\\"true\\" customclass=\\"\\" iconrightclickable=\\"false\\" autocomplete=\\"off\\" loading=\\"false\\" readonly=\\"\\" rounded=\\"false\\" use-html5-validation=\\"true\\"></b-input-stub>
<b-input-stub autocomplete=\\"off\\" type=\\"text\\" lazy=\\"false\\" passwordreveal=\\"false\\" iconclickable=\\"false\\" hascounter=\\"true\\" customclass=\\"\\" iconrightclickable=\\"false\\" loading=\\"false\\" readonly=\\"\\" rounded=\\"false\\" use-html5-validation=\\"true\\"></b-input-stub>
</div>
<transition-stub name=\\"fade\\" appear=\\"false\\" persisted=\\"false\\" css=\\"true\\">
<div class=\\"background\\" aria-hidden=\\"true\\" style=\\"display: none;\\"></div>
Expand Down
2 changes: 0 additions & 2 deletions packages/buefy-next/src/utils/FormElementMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const FormElementMixin = defineComponent({
rounded: Boolean,
icon: String,
iconPack: String,
// Native options to use in HTML5 validation
autocomplete: String,
maxlength: [Number, String],
useHtml5Validation: {
type: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<b-taginput
v-model="tags"
:data="filteredTags"
autocomplete="on"
autocomplete
:allow-new="allowNew"
:open-on-focus="openOnFocus"
field="user.first_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<b-taginput
v-model="tags"
:data="filteredTags"
autocomplete="on"
autocomplete
ref="taginput"
icon="label"
placeholder="Add a tag"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<b-taginput
v-model="tags"
:data="filteredTags"
autocomplete="on"
autocomplete
field="user.first_name"
icon="label"
placeholder="Add a tag"
Expand Down
Loading