fix(core): update tabindex on state change (#5231) (#5232)

This commit is contained in:
Nazar 2024-06-14 05:35:50 +02:00 committed by GitHub
parent 33de6fef67
commit d122980cec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,11 @@ context('/src/GuideContent/ReadOnly/React/', () => {
cy.get('.tiptap').type('Edited: ')
cy.get('.tiptap p:first').should('not.contain', 'Edited: ')
cy
.get('.tiptap')
.invoke('attr', 'tabindex')
.should('not.exist')
})
})
@ -24,6 +29,11 @@ context('/src/GuideContent/ReadOnly/React/', () => {
cy.get('.tiptap').type('Edited: ')
cy.get('.tiptap p:first').should('contain', 'Edited: ')
cy
.get('.tiptap')
.invoke('attr', 'tabindex')
.should('eq', '0')
})
})
})

View File

@ -10,7 +10,7 @@ export const Tabindex = Extension.create({
new Plugin({
key: new PluginKey('tabindex'),
props: {
attributes: this.editor.isEditable ? { tabindex: '0' } : {},
attributes: (): { [name: string]: string; } => (this.editor.isEditable ? { tabindex: '0' } : {}),
},
}),
]