fix: guard aria-describedby from rendering undefined string

This commit is contained in:
pyr0ball 2026-04-08 15:22:12 -07:00
parent 8873920b83
commit e16ea95dcc
2 changed files with 7 additions and 1 deletions

View file

@ -59,4 +59,10 @@ describe('SftCorrectionArea', () => {
await w.find('textarea').trigger('keydown', { key: 'Enter', ctrlKey: true }) await w.find('textarea').trigger('keydown', { key: 'Enter', ctrlKey: true })
expect(w.emitted('submit')).toBeFalsy() expect(w.emitted('submit')).toBeFalsy()
}) })
it('omits aria-describedby when describedBy prop is not provided', () => {
const w = mount(SftCorrectionArea)
const textarea = w.find('textarea')
expect(textarea.attributes('aria-describedby')).toBeUndefined()
})
}) })

View file

@ -10,7 +10,7 @@
class="correction-textarea" class="correction-textarea"
aria-label="Write corrected response" aria-label="Write corrected response"
aria-required="true" aria-required="true"
:aria-describedby="describedBy" :aria-describedby="describedBy || undefined"
placeholder="Write the response this model should have given..." placeholder="Write the response this model should have given..."
rows="4" rows="4"
@keydown.escape="$emit('cancel')" @keydown.escape="$emit('cancel')"