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

Fix placeholder not configurable for fieldRplSelect #601

Merged
merged 4 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
32 changes: 17 additions & 15 deletions packages/components/Molecules/Form/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,25 @@ export default {
return false
},
focusItem (selected) {
this.focussed = selected
const item = this.$el.querySelector(`#${selected.uuid}`)
const listbox = this.$refs.listbox
if (selected) {
this.focussed = selected
const item = this.$el.querySelector(`#${selected.uuid}`)
const listbox = this.$refs.listbox

if (listbox.scrollHeight > listbox.clientHeight) {
let scrollBottom = listbox.clientHeight + listbox.scrollTop
let elementBottom = item.offsetTop + item.offsetHeight
if (elementBottom > scrollBottom) {
listbox.scrollTop = elementBottom - listbox.clientHeight
} else if (item.offsetTop < listbox.scrollTop) {
listbox.scrollTop = item.offsetTop
if (listbox.scrollHeight > listbox.clientHeight) {
let scrollBottom = listbox.clientHeight + listbox.scrollTop
let elementBottom = item.offsetTop + item.offsetHeight
if (elementBottom > scrollBottom) {
listbox.scrollTop = elementBottom - listbox.clientHeight
} else if (item.offsetTop < listbox.scrollTop) {
listbox.scrollTop = item.offsetTop
}
}
if (item) {
this.$nextTick(function () {
item.focus()
})
}
}
if (item) {
this.$nextTick(function () {
item.focus()
})
}
},
handleKeys (e) {
Expand Down
7 changes: 2 additions & 5 deletions packages/components/Molecules/Form/fields/fieldRplselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ export default {
computed: {
config () {
return {
multiselect: this.schema.multiselect,
placeholder: 'Select',
showitems: 4,
fieldId: this.getFieldID(this.schema),
label: ''
...this.schema,
fieldId: this.getFieldID(this.schema)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/__snapshots__/storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5403,7 +5403,7 @@ exports[`RippleStoryshots Molecules/Form Default 1`] = `
disabled="disabled"
value=""
>
Select
Select a single topic
</option>

<option
Expand Down