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

[draft - on hold] Expand pa11y coverage #3521

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c5400fa
test expanding pa11y
zandercymatics Feb 13, 2025
712267f
remove
zandercymatics Feb 13, 2025
725e0e8
test other options
zandercymatics Feb 13, 2025
a154046
Elevate user priv
zandercymatics Feb 13, 2025
5e60adf
Update common.py
zandercymatics Feb 13, 2025
5b3a5b6
Update common.py
zandercymatics Feb 13, 2025
a7ca915
Update common.py
zandercymatics Feb 13, 2025
284cdd8
Add mythical user
zandercymatics Feb 14, 2025
db41129
test out org/non-org logic
zandercymatics Feb 14, 2025
0d79629
add hardcoded user
zandercymatics Feb 14, 2025
3a12e59
Fix andi errors
zandercymatics Feb 18, 2025
0e09e57
Test making button clickable
zandercymatics Feb 19, 2025
4a63493
Change all <a> buttons to <button>
zandercymatics Feb 19, 2025
5c7d432
Merge branch 'za/3180-add-unique-accessible-names' into za/3526-fix-l…
zandercymatics Feb 19, 2025
e9432cc
Merge branch 'main' into za/3526-fix-link-accessibility-issues
zandercymatics Feb 19, 2025
20ff354
fix aria warning
zandercymatics Feb 19, 2025
2cfce34
Add aria-label for table sort buttons
zandercymatics Feb 19, 2025
3bfb75f
Update src/registrar/assets/src/sass/_theme/_admin.scss
zandercymatics Feb 19, 2025
eb02869
lint
zandercymatics Feb 20, 2025
63cfb6f
Merge branch 'main' into za/3526-fix-link-accessibility-issues
zandercymatics Feb 20, 2025
38c8128
Merge branch 'main' into za/3526-fix-link-accessibility-issues
zandercymatics Feb 20, 2025
98b47da
Merge branch 'main' into za/3526-fix-link-accessibility-issues
zandercymatics Feb 21, 2025
0d17b86
Experiment hard-coding ids for pa11y
zandercymatics Feb 21, 2025
5e5c2a4
add fake domain
zandercymatics Feb 21, 2025
c09fe8c
cleanup script a bit
zandercymatics Feb 21, 2025
703528d
fix bug
zandercymatics Feb 21, 2025
597e2ff
Update fixtures_requests.py
zandercymatics Feb 21, 2025
c8c33ec
Merge branch 'main' into za/2252-expand-pa11y-coverage-2
zandercymatics Feb 21, 2025
c9e1ed8
Add legend
zandercymatics Feb 21, 2025
a567b4d
add sr legend
zandercymatics Feb 21, 2025
45c5965
Make all forms inherit base change form
zandercymatics Feb 21, 2025
3bf6dd9
add aria hidden
zandercymatics Feb 21, 2025
9946e9c
Cleanup pa11y scanner
zandercymatics Feb 21, 2025
6ff19e8
Merge branch 'za/3526-fix-link-accessibility-issues' into za/2252-exp…
zandercymatics Feb 21, 2025
28b7e8f
Add some additional exclusions
zandercymatics Feb 21, 2025
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
14 changes: 13 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,21 @@ jobs:
# leverage the docker compose setup that we already have for local development
run: docker compose up -d

- name: run pa11y
- name: run pa11y in non-org mode
working-directory: ./src
run: |
sleep 20;
npm i -g pa11y-ci
pa11y-ci

# - name: Enable org waffle flags
# working-directory: ./src
# # Run a specific command that enables organization_feature, organization_requests, and organization_member.
# run: docker compose exec app ./manage.py enable_org_waffle_flags

# - name: run pa11y in org mode
# working-directory: ./src
# run: |
# sleep 20;
# npm i -g pa11y-ci
# pa11y-ci
226 changes: 208 additions & 18 deletions src/.pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,217 @@
"concurrency": 1,
"timeout": 30000
},
"viewport": {
"width": 1920,
"height": 1080
},
"actions": [
"wait for url to be #"
],
"urls": [
"http://localhost:8080/",
"http://localhost:8080/health/",
"http://localhost:8080/domains/",
"http://localhost:8080/no-organization-domains/",
"http://localhost:8080/members/",
"http://localhost:8080/member/9999/",
"http://localhost:8080/member/9999/delete/",
"http://localhost:8080/member/9999/permissions/",
"http://localhost:8080/member/9999/domains/",
"http://localhost:8080/member/9999/domains/edit/",
"http://localhost:8080/invitedmember/9999/",
"http://localhost:8080/invitedmember/9999/delete/",
"http://localhost:8080/invitedmember/9999/permissions/",
"http://localhost:8080/invitedmember/9999/domains/",
"http://localhost:8080/invitedmember/9999/domains/edit/",
"http://localhost:8080/members/new-member/",
"http://localhost:8080/requests/",
"http://localhost:8080/no-organization-requests/",
"http://localhost:8080/organization/",
"http://localhost:8080/senior-official/",
"http://localhost:8080/admin/analytics/",
"http://localhost:8080/admin/registrar/user/1/transfer/",
"http://localhost:8080/admin/",
"http://localhost:8080/admin/registrar/user/",
"http://localhost:8080/admin/registrar/user/add/",
"http://localhost:8080/admin/registrar/user/1/history/",
"http://localhost:8080/admin/registrar/user/1/delete/",
"http://localhost:8080/admin/registrar/user/1/change/",
"http://localhost:8080/admin/registrar/user/1/",
"http://localhost:8080/admin/registrar/usergroup/",
"http://localhost:8080/admin/registrar/usergroup/add/",
"http://localhost:8080/admin/registrar/usergroup/1/history/",
"http://localhost:8080/admin/registrar/usergroup/1/delete/",
"http://localhost:8080/admin/registrar/usergroup/1/change/",
"http://localhost:8080/admin/registrar/usergroup/1/",
"http://localhost:8080/admin/registrar/userdomainrole/",
"http://localhost:8080/admin/registrar/userdomainrole/add/",
"http://localhost:8080/admin/registrar/userdomainrole/1/history/",
"http://localhost:8080/admin/registrar/userdomainrole/1/delete/",
"http://localhost:8080/admin/registrar/userdomainrole/1/change/",
"http://localhost:8080/admin/registrar/userdomainrole/1/",
"http://localhost:8080/admin/registrar/contact/",
"http://localhost:8080/admin/registrar/contact/add/",
"http://localhost:8080/admin/registrar/contact/1/history/",
"http://localhost:8080/admin/registrar/contact/1/delete/",
"http://localhost:8080/admin/registrar/contact/1/change/",
"http://localhost:8080/admin/registrar/contact/1/",
"http://localhost:8080/admin/registrar/domaininvitation/",
"http://localhost:8080/admin/registrar/domaininvitation/add/",
"http://localhost:8080/admin/registrar/domaininvitation/1/history/",
"http://localhost:8080/admin/registrar/domaininvitation/1/delete/",
"http://localhost:8080/admin/registrar/domaininvitation/1/change/",
"http://localhost:8080/admin/registrar/domaininvitation/1/",
"http://localhost:8080/admin/registrar/domaininformation/",
"http://localhost:8080/admin/registrar/domaininformation/add/",
"http://localhost:8080/admin/registrar/domaininformation/1/history/",
"http://localhost:8080/admin/registrar/domaininformation/1/delete/",
"http://localhost:8080/admin/registrar/domaininformation/1/change/",
"http://localhost:8080/admin/registrar/domaininformation/1/",
"http://localhost:8080/admin/registrar/domain/",
"http://localhost:8080/admin/registrar/domain/add/",
"http://localhost:8080/admin/registrar/domain/1/history/",
"http://localhost:8080/admin/registrar/domain/1/delete/",
"http://localhost:8080/admin/registrar/domain/1/change/",
"http://localhost:8080/admin/registrar/domain/1/",
"http://localhost:8080/admin/registrar/draftdomain/",
"http://localhost:8080/admin/registrar/draftdomain/add/",
"http://localhost:8080/admin/registrar/draftdomain/1/history/",
"http://localhost:8080/admin/registrar/draftdomain/1/delete/",
"http://localhost:8080/admin/registrar/draftdomain/1/change/",
"http://localhost:8080/admin/registrar/draftdomain/1/",
"http://localhost:8080/admin/registrar/federalagency/",
"http://localhost:8080/admin/registrar/federalagency/add/",
"http://localhost:8080/admin/registrar/federalagency/1/history/",
"http://localhost:8080/admin/registrar/federalagency/1/delete/",
"http://localhost:8080/admin/registrar/federalagency/1/change/",
"http://localhost:8080/admin/registrar/federalagency/1/",
"http://localhost:8080/admin/registrar/host/",
"http://localhost:8080/admin/registrar/host/add/",
"http://localhost:8080/admin/registrar/host/1/history/",
"http://localhost:8080/admin/registrar/host/1/delete/",
"http://localhost:8080/admin/registrar/host/1/change/",
"http://localhost:8080/admin/registrar/host/1/",
"http://localhost:8080/admin/registrar/hostip/",
"http://localhost:8080/admin/registrar/hostip/add/",
"http://localhost:8080/admin/registrar/hostip/1/history/",
"http://localhost:8080/admin/registrar/hostip/1/delete/",
"http://localhost:8080/admin/registrar/hostip/1/change/",
"http://localhost:8080/admin/registrar/hostip/1/",
"http://localhost:8080/admin/registrar/website/",
"http://localhost:8080/admin/registrar/website/add/",
"http://localhost:8080/admin/registrar/website/1/history/",
"http://localhost:8080/admin/registrar/website/1/delete/",
"http://localhost:8080/admin/registrar/website/1/change/",
"http://localhost:8080/admin/registrar/website/1/",
"http://localhost:8080/admin/registrar/publiccontact/",
"http://localhost:8080/admin/registrar/publiccontact/add/",
"http://localhost:8080/admin/registrar/publiccontact/1/history/",
"http://localhost:8080/admin/registrar/publiccontact/1/delete/",
"http://localhost:8080/admin/registrar/publiccontact/1/change/",
"http://localhost:8080/admin/registrar/publiccontact/1/",
"http://localhost:8080/admin/registrar/domainrequest/",
"http://localhost:8080/admin/registrar/domainrequest/add/",
"http://localhost:8080/admin/registrar/domainrequest/1/history/",
"http://localhost:8080/admin/registrar/domainrequest/1/delete/",
"http://localhost:8080/admin/registrar/domainrequest/1/change/",
"http://localhost:8080/admin/registrar/domainrequest/1/",
"http://localhost:8080/admin/registrar/transitiondomain/",
"http://localhost:8080/admin/registrar/transitiondomain/add/",
"http://localhost:8080/admin/registrar/transitiondomain/1/history/",
"http://localhost:8080/admin/registrar/transitiondomain/1/delete/",
"http://localhost:8080/admin/registrar/transitiondomain/1/change/",
"http://localhost:8080/admin/registrar/transitiondomain/1/",
"http://localhost:8080/admin/registrar/verifiedbystaff/",
"http://localhost:8080/admin/registrar/verifiedbystaff/add/",
"http://localhost:8080/admin/registrar/verifiedbystaff/1/history/",
"http://localhost:8080/admin/registrar/verifiedbystaff/1/delete/",
"http://localhost:8080/admin/registrar/verifiedbystaff/1/change/",
"http://localhost:8080/admin/registrar/verifiedbystaff/1/",
"http://localhost:8080/admin/registrar/portfolioinvitation/",
"http://localhost:8080/admin/registrar/portfolioinvitation/add/",
"http://localhost:8080/admin/registrar/portfolioinvitation/1/history/",
"http://localhost:8080/admin/registrar/portfolioinvitation/1/delete/",
"http://localhost:8080/admin/registrar/portfolioinvitation/1/change/",
"http://localhost:8080/admin/registrar/portfolioinvitation/1/",
"http://localhost:8080/admin/registrar/portfolio/",
"http://localhost:8080/admin/registrar/portfolio/add/",
"http://localhost:8080/admin/registrar/portfolio/1/history/",
"http://localhost:8080/admin/registrar/portfolio/1/delete/",
"http://localhost:8080/admin/registrar/portfolio/1/change/",
"http://localhost:8080/admin/registrar/portfolio/1/",
"http://localhost:8080/admin/registrar/domaingroup/",
"http://localhost:8080/admin/registrar/domaingroup/add/",
"http://localhost:8080/admin/registrar/domaingroup/1/history/",
"http://localhost:8080/admin/registrar/domaingroup/1/delete/",
"http://localhost:8080/admin/registrar/domaingroup/1/change/",
"http://localhost:8080/admin/registrar/domaingroup/1/",
"http://localhost:8080/admin/registrar/suborganization/",
"http://localhost:8080/admin/registrar/suborganization/add/",
"http://localhost:8080/admin/registrar/suborganization/1/history/",
"http://localhost:8080/admin/registrar/suborganization/1/delete/",
"http://localhost:8080/admin/registrar/suborganization/1/change/",
"http://localhost:8080/admin/registrar/suborganization/1/",
"http://localhost:8080/admin/registrar/seniorofficial/",
"http://localhost:8080/admin/registrar/seniorofficial/add/",
"http://localhost:8080/admin/registrar/seniorofficial/1/history/",
"http://localhost:8080/admin/registrar/seniorofficial/1/delete/",
"http://localhost:8080/admin/registrar/seniorofficial/1/change/",
"http://localhost:8080/admin/registrar/seniorofficial/1/",
"http://localhost:8080/admin/registrar/userportfoliopermission/",
"http://localhost:8080/admin/registrar/userportfoliopermission/add/",
"http://localhost:8080/admin/registrar/userportfoliopermission/1/history/",
"http://localhost:8080/admin/registrar/userportfoliopermission/1/delete/",
"http://localhost:8080/admin/registrar/userportfoliopermission/1/change/",
"http://localhost:8080/admin/registrar/userportfoliopermission/1/",
"http://localhost:8080/admin/registrar/allowedemail/",
"http://localhost:8080/admin/registrar/allowedemail/add/",
"http://localhost:8080/admin/registrar/allowedemail/1/history/",
"http://localhost:8080/admin/registrar/allowedemail/1/delete/",
"http://localhost:8080/admin/registrar/allowedemail/1/change/",
"http://localhost:8080/admin/registrar/allowedemail/1/",
"http://localhost:8080/admin/registrar/",
"http://localhost:8080/admin/1/",
"http://localhost:8080/domain-request/9999/edit/",
"http://localhost:8080/domain-request/9999/",
"http://localhost:8080/domain-request/viewonly/9999/",
"http://localhost:8080/domain-request/9999/withdraw/",
"http://localhost:8080/domain-request/9999/withdrawconfirmed/",
"http://localhost:8080/request/",
"http://localhost:8080/request/start",
"http://localhost:8080/request/organization/",
"http://localhost:8080/request/org_federal/",
"http://localhost:8080/request/org_election/",
"http://localhost:8080/request/org_contact/",
"http://localhost:8080/request/senior_official/",
"http://localhost:8080/request/current_sites/",
"http://localhost:8080/request/dotgov_domain/",
"http://localhost:8080/request/purpose/",
"http://localhost:8080/request/your_contact/",
"http://localhost:8080/request/other_contacts/",
"http://localhost:8080/request/anything_else/",
"http://localhost:8080/request/requirements/",
"http://localhost:8080/request/start/",
"http://localhost:8080/request/finished/",
"http://localhost:8080/request/requesting_entity/",
"http://localhost:8080/request/9999/generic_org_type/",
"http://localhost:8080/request/9999/tribal_government/",
"http://localhost:8080/request/9999/organization_federal/",
"http://localhost:8080/request/9999/organization_election/",
"http://localhost:8080/request/9999/organization_contact/",
"http://localhost:8080/request/9999/about_your_organization/",
"http://localhost:8080/request/9999/senior_official/",
"http://localhost:8080/request/9999/current_sites/",
"http://localhost:8080/request/9999/dotgov_domain/",
"http://localhost:8080/request/9999/purpose/",
"http://localhost:8080/request/9999/other_contacts/",
"http://localhost:8080/request/9999/additional_details/",
"http://localhost:8080/request/9999/requirements/",
"http://localhost:8080/request/9999/review/",
"http://localhost:8080/request/9999/portfolio_requesting_entity/",
"http://localhost:8080/request/9999/portfolio_additional_details/",
"http://localhost:8080/domain/9999/",
"http://localhost:8080/domain/9999/prototype-dns/",
"http://localhost:8080/domain/9999/users/",
"http://localhost:8080/domain/9999/dns/",
"http://localhost:8080/domain/9999/dns/nameservers/",
"http://localhost:8080/domain/9999/dns/dnssec/",
"http://localhost:8080/domain/9999/dns/dnssec/dsdata/",
"http://localhost:8080/domain/9999/org-name-address/",
"http://localhost:8080/domain/9999/suborganization/",
"http://localhost:8080/domain/9999/senior-official/",
"http://localhost:8080/domain/9999/security-email/",
"http://localhost:8080/domain/9999/renewal/",
"http://localhost:8080/domain/9999/users/add/",
"http://localhost:8080/finish-profile-setup/",
"http://localhost:8080/user-profile/",
"http://localhost:8080/members/",
"http://localhost:8080/members/new-member"
"http://localhost:8080/invitation/9999/cancel/",
"http://localhost:8080/domain-request/9999/delete/",
"http://localhost:8080/domain/9999/users/9999/delete/"
]
}
}
17 changes: 9 additions & 8 deletions src/registrar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ def get_queryset(cls, db_field):

class AuditedAdmin(admin.ModelAdmin):
"""Custom admin to make auditing easier."""
change_form_template = "django/admin/base_change_form.html"

def history_view(self, request, object_id, extra_context=None):
"""On clicking 'History', take admin to the auditlog view for an object."""
Expand Down Expand Up @@ -1115,7 +1116,7 @@ class ContactAdmin(ListHeaderAdmin, ImportExportModelAdmin):
)
]

change_form_template = "django/admin/email_clipboard_change_form.html"
change_form_template = "django/admin/base_change_form.html"

# We name the custom prop 'contact' because linter
# is not allowing a short_description attr on it
Expand Down Expand Up @@ -1246,7 +1247,6 @@ class Meta:

class WebsiteAdmin(ListHeaderAdmin, ImportExportModelAdmin):
"""Custom website admin class."""

resource_classes = [WebsiteResource]

# Search
Expand Down Expand Up @@ -2289,11 +2289,12 @@ def custom_election_board(self, obj):
@admin.display(description=_("Requested Domain"))
def custom_requested_domain(self, obj):
# Example: Show different icons based on `status`
url = reverse("admin:registrar_domainrequest_changelist") + f"{obj.id}"
text = obj.requested_domain
if obj.portfolio:
return format_html('<a href="{}"><img src="/public/admin/img/icon-yes.svg"> {}</a>', url, text)
return format_html('<a href="{}">{}</a>', url, text)
return format_html(
f'<img class="padding-right-05" src="/public/admin/img/icon-yes.svg" aria-hidden="true">{escape(text)}'
)
return text

custom_requested_domain.admin_order_field = "requested_domain__name" # type: ignore

Expand Down Expand Up @@ -3086,7 +3087,7 @@ class TransitionDomainAdmin(ListHeaderAdmin):
search_fields = ["username", "domain_name"]
search_help_text = "Search by user or domain name."

change_form_template = "django/admin/email_clipboard_change_form.html"
change_form_template = "django/admin/base_change_form.html"


class DomainInformationInline(admin.StackedInline):
Expand Down Expand Up @@ -4026,7 +4027,7 @@ class PublicContactAdmin(ListHeaderAdmin, ImportExportModelAdmin):

resource_classes = [PublicContactResource]

change_form_template = "django/admin/email_clipboard_change_form.html"
change_form_template = "django/admin/base_change_form.html"
autocomplete_fields = ["domain"]

def changeform_view(self, request, object_id=None, form_url="", extra_context=None):
Expand All @@ -4052,7 +4053,7 @@ class VerifiedByStaffAdmin(ListHeaderAdmin):
"requestor",
]

change_form_template = "django/admin/email_clipboard_change_form.html"
change_form_template = "django/admin/base_change_form.html"

def truncated_notes(self, obj):
# Truncate the 'notes' field to 50 characters
Expand Down
15 changes: 15 additions & 0 deletions src/registrar/assets/src/js/getgov-admin/button-utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Initializes buttons to behave like links by navigating to their data-url attribute
* Example usage: <button class="use-button-as-link" data-url="/some/path">Click me</button>
*/
export function initButtonLinks() {
document.querySelectorAll('button.use-button-as-link').forEach(button => {
button.addEventListener('click', function() {
// Equivalent to button.getAttribute("data-href")
const href = this.dataset.href;
if (href) {
window.location.href = href;
}
});
});
}
2 changes: 2 additions & 0 deletions src/registrar/assets/src/js/getgov-admin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import { initDynamicPortfolioFields } from './portfolio-form.js';
import { initDynamicDomainInformationFields } from './domain-information-form.js';
import { initDynamicDomainFields } from './domain-form.js';
import { initAnalyticsDashboard } from './analytics.js';
import { initButtonLinks } from './button-utils.js';

// General
initModals();
initCopyToClipboard();
initFilterHorizontalWidget();
initDescriptions();
initSubmitBar();
initButtonLinks();

// Domain request
initIneligibleModal();
Expand Down
14 changes: 13 additions & 1 deletion src/registrar/assets/src/sass/_theme/_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ input[type=submit].button--dja-toolbar:focus, input[type=submit].button--dja-too
font-size: 13px;
}

.object-tools li button {
.object-tools li button, button.addlink {
font-family: Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;
text-transform: none !important;
font-size: 14px !important;
Expand All @@ -520,6 +520,14 @@ input[type=submit].button--dja-toolbar:focus, input[type=submit].button--dja-too
}
}

// Mimic the style for <a>
.object-tools > p > button.addlink {
background-image: url(../admin/img/tooltag-add.svg) !important;
background-repeat: no-repeat !important;
background-position: right 7px center !important;
padding-right: 25px;
}

.usa-modal--django-admin .usa-prose ul > li {
list-style-type: inherit;
// Styling based off of the <p> styling in django admin
Expand Down Expand Up @@ -984,3 +992,7 @@ ul.add-list-reset {
}

}

#result_list > tbody tr > th > a {
text-decoration: underline;
}
Loading
Loading