Skip to content

DTR-1784: remove checkbox#68

Open
jamalosman wants to merge 5 commits intomainfrom
DTR-1785-2
Open

DTR-1784: remove checkbox#68
jamalosman wants to merge 5 commits intomainfrom
DTR-1785-2

Conversation

@jamalosman
Copy link
Contributor

No description provided.

@platops-pr-bot
Copy link

Copy link
Contributor

@wg-hmrc wg-hmrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch name doesn’t match the PR title, and the commits reference a different ticket ID. Can you clarify whether this is intentional?

linkTextUrlTwo = "monthlyreturns.selectSubcontractors.deselectAll.link",
linkUrlTwo = controllers.monthlyreturns.routes.SelectSubcontractorsController.onPageLoadNonEmpty(Some(false)).url
)
@if(subcontractors.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@if(subcontractors.length > 0) {
@if(subcontractors.nonEmpty) {

We can do this instead and avoid unnecessary count

</div>
</div>
"""
rows = if (subcontractors == Nil) Seq(Seq(TableRow(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use isEmpty or nonEmpty over == Nil for readability

value="${subcontractor.id}"
${if (form.value.toList.flatMap(_.subcontractorsToInclude).contains(subcontractor.id)) "checked" else ""}
>
<label class="govuk-label govuk-checkboxes__label" for="${subcontractor.name.split(',')(0).toLowerCase}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The <label for="..."> does not match the checkbox id. The for attribute should reference the input id to ensure correct accessibility behaviour.

${if (form.value.toList.flatMap(_.subcontractorsToInclude).contains(subcontractor.id)) "checked" else ""}
>
<label class="govuk-label govuk-checkboxes__label" for="${subcontractor.name.split(',')(0).toLowerCase}">
<span class="govuk-visually-hidden">Include ${subcontractor.name}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include is hard-coded, please move it to the translation file

TableRow(
content = HtmlContent(
s"""
<div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big fan of hardcoding html, this can cause accessibility and maintenance issues, did you try using the GovUK components ?

<input
class="govuk-checkboxes__input"
id="${subcontractor.id}"
name="subcontractorsToInclude.$index"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name="subcontractorsToInclude.$index"
name="subcontractorsToInclude[$index]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants