Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility improvements on newly added features #2920

Merged
merged 8 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/assets/javascripts/admin/form_answers.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ready = ->
section.find(".document-list .p-empty").removeClass("visuallyhidden")
$('#commercial-figures-attachment-form').toggleClass('visuallyhidden', $('.commercial-figures-file').length != 0)
initializeFileUpload()

toggleCommercialFiguresButtonVisibility()

if $("html").hasClass("lte-ie7")
Expand Down Expand Up @@ -228,7 +228,7 @@ ready = ->
if $('.vat-returns-file').length == 0
section.find(".document-list .p-empty").removeClass("visuallyhidden")
$('#shortlisted-documents-status').attr('data-status-reversible', 'false')
else
else
$('#shortlisted-documents-status').attr('data-status-reversible', 'true')

$(document).on 'click', "#shortlisted-documents-status a", (e) ->
Expand Down Expand Up @@ -440,7 +440,7 @@ showErrorForInvalidField = (field, values, containerSelector = '.form-container'

buildBannerHtml = (message, type, identifier = null) ->
id = identifier || "alert__#{String(Math.random()).slice(2, -1)}"

"<div id='#{id}' class='alert alert-#{type}' data-controller='element-removal' role='alert' style='padding-top: 6px; padding-bottom: 6px; margin-bottom: 8px;'>
#{message}
<button type='button' class='close' data-action='click->element-removal#remove' aria-label='Close'>
Expand Down
12 changes: 6 additions & 6 deletions app/assets/javascripts/frontend/form-validation.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -493,22 +493,22 @@ window.FormValidation =

if not val
if !requiredRowParent
@appendMessage(qCell, "Required")
@appendMessage(qCell, "Must be filled in. Enter '0' if none")
@addErrorClass(question)
# only adds 'required' error when y_heading matches checked answer
else
cond = map.get(key)

if cond
@appendMessage(qCell, "Required")
@appendMessage(qCell, "Must be filled in. Enter '0' if none")
@addErrorClass(question)
else if isNaN(val)
@appendMessage(qCell, "Only numbers")
@appendMessage(qCell, "Enter only numbers")
@addErrorClass(question)
else
t = parseInt(val, 10)
if t < 0
@appendMessage(qCell, "At least 0")
@appendMessage(qCell, "Enter a number equal to or greater than 0")
@addErrorClass(question)

if question.find(".govuk-error-message").filter(-> @innerHTML).length
Expand Down Expand Up @@ -550,8 +550,8 @@ window.FormValidation =
inputCellsCounter += 1
label = @extractText(subq.attr('id'))
if not subq.val() and question.hasClass("question-required")
@logThis(question, "validateNumberByYears", "Question #{questionRef} is incomplete. #{label} is required and must be filled in.")
@appendMessage(errContainer, "Question #{questionRef} is incomplete. #{label} is required and must be filled in.")
@logThis(question, "validateNumberByYears", "Question #{questionRef} is incomplete. #{label} is required and must be filled in. Enter '0' if none.")
@appendMessage(errContainer, "Question #{questionRef} is incomplete. #{label} is required and must be filled in. Enter '0' if none.")
@addErrorClass(question)
continue
else if not subq.val()
Expand Down
17 changes: 17 additions & 0 deletions app/assets/stylesheets/admin/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,20 @@ input.form-control, select.form-control,
margin-right: 15px !important;
}
}

span.govuk-radios__item {
min-height: 24px;
:hover {
background-color: #e6e6e6;
border-color: grey;
border-width: 1px;
border-style: solid;
border-radius: 5px;
margin-left: -5px;
padding-left: 24px;
padding-right: 4px;
}
input {
top: 1.5px;
}
}
2 changes: 1 addition & 1 deletion app/controllers/admin/assessors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def bulk_activate_dt

def bulk_deactivate_dt
authorize Assessor, :deactivate?
@form = ConfirmationForm.new("bulk_activate_assessors", params[:confirmation_form])
@form = ConfirmationForm.new("bulk_deactivate_assessors", params[:confirmation_form])

if @form.valid?
if @form.confirmed?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

= f.submit 'Remove', class: 'if-js-hide'

= link_to "#", class: "text-danger if-no-js-hide", data: {confirm: "Are you sure?"}
= link_to "#", class: "text-danger if-no-js-hide", data: {confirm: "Are you sure?"}, aria: { label: "Remove #{form_answer_attachment.decorate.display_name}"}
span.glyphicon.glyphicon-remove
span.visible-lg.visible-md
' Remove
Expand Down
45 changes: 23 additions & 22 deletions app/views/admin/form_answers/_section_documents.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@
' Application & Supporting Docs
= render "admin/form_answers/docs/application_and_supporting_docs"

.well
.sidebar-section.space-y-2
h2
' Post Shortlisting Docs
- if @form_answer.requires_vocf? || @form_answer.provided_estimates?
.well
.sidebar-section.space-y-2
h2
' Post Shortlisting Docs

- if @form_answer.requires_vocf?
div[data-controller="inline-flash"]
.document-list.space-y-2
= render(partial: "admin/form_answers/docs/status", locals: { form_answer: @form_answer })
- if @form_answer.requires_vocf?
div[data-controller="inline-flash"]
.document-list.space-y-2
= render(partial: "admin/form_answers/docs/status", locals: { form_answer: @form_answer })

- if @form_answer.audit_certificate.blank? && Settings.after_shortlisting_stage?
.sidebar-section.no-margin-bottom.space-y-3
- if @form_answer.requires_vocf?
- if @form_answer.audit_certificate.blank? && Settings.after_shortlisting_stage?
.sidebar-section.no-margin-bottom.space-y-3
#audit-certificate-form[data-controller="inline-flash"]
- audit_certificate = @form_answer.build_audit_certificate
= render "admin/audit_certificate/form", form_answer: @form_answer, audit_certificate: audit_certificate

- elsif @form_answer.provided_estimates?
- figures_form = @form_answer.shortlisted_documents_wrapper || @form_answer.build_shortlisted_documents_wrapper
- elsif @form_answer.provided_estimates?
- figures_form = @form_answer.shortlisted_documents_wrapper || @form_answer.build_shortlisted_documents_wrapper

= render(partial: "admin/figures_and_vat_returns/status", locals: { form_answer: @form_answer, figures_form: figures_form })
= render(partial: "admin/figures_and_vat_returns/status", locals: { form_answer: @form_answer, figures_form: figures_form })

#vat-returns-section[data-controller="inline-flash"]
= render(partial: "admin/figures_and_vat_returns/vat_returns", locals: { form_answer: @form_answer, figures_form: figures_form })
#commercial-figures-section[data-controller="inline-flash"]
= render(partial: "admin/figures_and_vat_returns/actual_figures", locals: { form_answer: @form_answer, figures_form: figures_form })
#vat-returns-section[data-controller="inline-flash"]
= render(partial: "admin/figures_and_vat_returns/vat_returns", locals: { form_answer: @form_answer, figures_form: figures_form })
#commercial-figures-section[data-controller="inline-flash"]
= render(partial: "admin/figures_and_vat_returns/actual_figures", locals: { form_answer: @form_answer, figures_form: figures_form })

= render "admin/form_answers/docs/post_shortlisting_docs", resource: resource
= render "admin/form_answers/docs/post_shortlisting_docs", resource: resource

/ TODO Only appears for EP but for now we need to think more on it
/.sidebar-section
Expand All @@ -61,11 +61,12 @@
' Other Docs
div[data-controller="inline-flash"]
.document-list
p.p-empty class="#{'visuallyhidden' if @form_answer.form_answer_attachments.any?}"
p.p-empty class="#{'visuallyhidden' if @form_answer.form_answer_attachments.uploaded_not_by_user.any?}"
' No documents have been attached.
ul.list-unstyled.list-actions
- if @form_answer.form_answer_attachments.uploaded_not_by_user.any?
- if @form_answer.form_answer_attachments.uploaded_not_by_user.any?
ul.list-unstyled.list-actions
= render(partial: "admin/form_answer_attachments/form_answer_attachment", collection: @form_answer.form_answer_attachments.uploaded_not_by_user.visible_for(current_subject))

.clear
br
#application-attachment-form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@

- else
p.p-empty
' No documents have been attached.


' No supporting documents have been attached.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
url: remove_audit_certificate_admin_form_answer_url(resource.object),
html: { method: :patch, style: "display:inline-block;", id: "remove-audit-certificate"}) do |f|

= f.submit 'Remove', class: 'if-js-hide'
= f.submit 'Remove audit certificate', class: 'if-js-hide'

= link_to "#", class: "text-danger if-no-js-hide js-remove-audit-certificate-link", data: {confirm: "Are you sure?"}
span.glyphicon.glyphicon-remove
span.visible-lg.visible-md
' Remove
' Remove audit certificate
- elsif resource.object.audit_certificate.present? && resource.object.audit_certificate.attachment_scan_results.blank?
li style="color:green"
' Scanning audit certificate. You may need to refresh the page.
Expand Down
5 changes: 3 additions & 2 deletions app/views/qae_form/_question_halted_alert.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ div class=class_names("govuk-error-summary govuk-error-summary--question-halted"
div class="govuk-warning-text__text"
span class="govuk-visually-hidden"
| Warning
h4 class="govuk-error-summary__title"
= title
- if title
h4 class="govuk-error-summary__title"
= title
div class="govuk-error-summary__body"
= message.respond_to?(:call) ? message.(value) : message
1 change: 1 addition & 0 deletions app/views/qae_form/_text_question.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ input[
id="q_#{question.key}"*possible_read_only_ops
aria-describedby=(@form_answer.validator_errors && @form_answer.validator_errors[question.hash_key] ? "error_for_#{question.key}" : nil )
data-word-max=question.text_words_max
aria-label=(strip_tags(question.context) unless (question.ref || question.sub_ref))
]
2 changes: 1 addition & 1 deletion forms/qae_form_builder/by_years_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def errors
question.active_fields.each.with_index(1) do |suffix, idx|
if !question.input_value(suffix: suffix).present?
result[question.hash_key(suffix: suffix)] ||= ""
result[question.hash_key(suffix: suffix)] << "Question #{question.ref || question.sub_ref} is incomplete. Financial year #{idx} is required and must be filled in."
result[question.hash_key(suffix: suffix)] << "Question #{question.ref || question.sub_ref} is incomplete. Financial year #{idx} is required and must be filled in. Enter '0' if none"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion forms/qae_form_builder/matrix_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def errors
if !question.input_value(suffix: suffix).present?
if (question.required_row_parent && question.required_rows.include?(y_heading.key)) || !question.required_row_parent
result[question.hash_key(suffix: suffix)] ||= ""
result[question.hash_key(suffix: suffix)] << "Required"
result[question.hash_key(suffix: suffix)] << "Must be filled in. Enter '0' if none"
end
else
if !/\A\d+\z/.match(question.input_value(suffix: suffix).to_s)
Expand Down
Loading