Skip to content

Commit

Permalink
Merge pull request #925 from nextcloud/fix/focus-first-input
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl authored Mar 14, 2024
2 parents c9faf04 + f5b0530 commit 053b6c0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions cypress/e2e/column-selection.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Test column ' + columnTitle, () => {
cy.get('button').contains('Create row').click()
cy.get('.modal__content h2').contains('Create row').should('be.visible')
cy.get('.modal__content .title').contains(columnTitle).should('be.visible')
cy.get('.modal__content .title').click()
cy.get('.modal__content .select span[title="second option"]').should('be.visible')
cy.get('button').contains('Save').click()
cy.get('.custom-table table tr td div').contains('second option').should('be.visible')
Expand Down
5 changes: 5 additions & 0 deletions src/modules/modals/CreateColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ export default {
combinedType() {
this.reset(false, false)
},
showModal() {
this.$nextTick(() => {
this.$el.querySelector('input')?.focus()
})
},
},
methods: {
snakeToCamel(str) {
Expand Down
7 changes: 7 additions & 0 deletions src/modules/modals/CreateRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ export default {
return mandatoryFieldsEmpty
},
},
watch: {
showModal() {
this.$nextTick(() => {
this.$el.querySelector('input')?.focus()
})
},
},
methods: {
actionCancel() {
this.reset()
Expand Down
4 changes: 3 additions & 1 deletion src/modules/modals/CreateTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
{{ icon }}
</NcButton>
</NcEmojiPicker>
<input v-model="title"
<input ref="titleInput"
v-model="title"
:class="{missing: errorTitle}"
type="text"
:placeholder="t('tables', 'Title of the new table')"
Expand Down Expand Up @@ -100,6 +101,7 @@ export default {
showModal() {
// every time when the modal opens chose a new emoji
this.loadEmoji()
this.$nextTick(() => this.$refs.titleInput.focus())
},
},
beforeMount() {
Expand Down
1 change: 1 addition & 0 deletions src/modules/modals/ViewSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export default {
this.reset()
await this.loadTableColumnsFromBE()
this.open = true
this.$nextTick(() => this.$el.querySelector('input')?.focus())
}
},
open(value) {
Expand Down

0 comments on commit 053b6c0

Please sign in to comment.