Skip to content

Commit

Permalink
Merge pull request #4407 from nextcloud-libraries/fix/a11y-for-richco…
Browse files Browse the repository at this point in the history
…ntenteditable-placeholder

fix(NcRichContenteditable): add aria-placeholder
  • Loading branch information
susnux authored Aug 16, 2023
2 parents 4cd880c + 892b713 commit 4c7c12a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export default {
}"
:contenteditable="canEdit"
:placeholder="placeholder"
:aria-placeholder="placeholder"
aria-multiline="true"
class="rich-contenteditable__input"
role="textbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,17 @@ describe('NcRichContenteditable', () => {
expect(handlers.paste).toHaveBeenCalledTimes(1)
expect(handlers.blur).toHaveBeenCalledTimes(1)
})

it('should has accessible placeholder from placeholder prop', async () => {
const PLACEHOLDER = 'TEST_PLACEHOLDER'
const { wrapper } = mountNcRichContenteditable({
propsData: {
placeholder: PLACEHOLDER,
},
})
// Accessible placeholder
expect(wrapper.attributes('aria-placeholder')).toBe(PLACEHOLDER)
// Used in CSS for visible placeholder
expect(wrapper.attributes('placeholder')).toBe(PLACEHOLDER)
})
})

0 comments on commit 4c7c12a

Please sign in to comment.