Skip to content

Commit

Permalink
Only warn if editing large text areas
Browse files Browse the repository at this point in the history
This was causing interruptions on pages with just brief descriptions, not all of which were even required.
  • Loading branch information
elceebee committed Dec 20, 2024
1 parent 016f44e commit e034fad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/frontend/packs/warn-on-unsaved-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const getCompleteSectionCheckbox = () => {
}

const getTextArea = () => {
return document.querySelector('.govuk-textarea')
const $textAreas = document.querySelectorAll('.govuk-textarea')

return [].filter.call($textAreas, ($textArea) => $textArea.rows > 5)[0]
}

const getFirstEnhanceableForm = () => {
Expand Down

0 comments on commit e034fad

Please sign in to comment.