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

fix(a11y): address a11y issues and enable tests #733

Merged
merged 41 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ac5a182
enhance: adding delete event checkbox
Aug 15, 2023
5a3f1e4
feat: adding branch field to scheduled builds
Aug 28, 2023
60afe98
feat: adding branch field to scheduled builds - and removing delete e…
Aug 29, 2023
229fe9c
feat: adding branch field to scheduled builds - and removing delete e…
Aug 29, 2023
761adff
fixing lint errors
Aug 29, 2023
2adddb1
Merge branch 'main' into enhance/scheduledBuildBranches
plyr4 Aug 29, 2023
7892a92
updating to show users the default scheduled build branch
Aug 30, 2023
995350c
:wqMerge branch 'enhance/scheduledBuildBranches' of github.com:go-vel…
Aug 30, 2023
ae7f30b
updating Main.elm
Aug 30, 2023
691ac07
updating Form.elm
Aug 30, 2023
ef7f44a
trying to fix things
Aug 30, 2023
14db7b3
fixing more things
Aug 30, 2023
592a214
letting users edit the scheduled build branch
Aug 30, 2023
c436b19
letting users edit the scheduled build branch
Aug 30, 2023
06a7a49
letting users edit the scheduled build branch
Aug 30, 2023
6015174
letting users edit the scheduled build branch
Aug 30, 2023
c8f1920
letting users edit the scheduled build branch
Aug 30, 2023
bbd380d
letting users edit the scheduled build branch
Aug 30, 2023
18d8044
fixing variable in Form.elm
Sep 6, 2023
bd5d3dc
changing deployment table
Oct 2, 2023
fa10d29
fixing some accessibility errors
Oct 6, 2023
23dc792
merge with main
Oct 6, 2023
c098333
seperating things
Oct 6, 2023
cc1aca3
enh(accessibility): added some aria-labels
KellyMerrick Oct 9, 2023
fca4983
enh(accessibility): updated checkA11y opts
KellyMerrick Oct 9, 2023
091d6be
taking elm popup out of testing
Oct 10, 2023
b737606
adding test exceptions
Oct 12, 2023
4628721
final accessibility fixes for now, updating colors
Oct 30, 2023
cce19dc
making prettier
Oct 30, 2023
0fd8bd5
fixing more errors
Oct 31, 2023
88ba985
fixing cypress tests
Oct 31, 2023
12a1e8a
fixing final cypress errors
Oct 31, 2023
923ae0c
fix: deleted unused comments
Nov 1, 2023
eceaf12
fixing things
Nov 1, 2023
aafc709
getting rid of primary2
Nov 1, 2023
49b9e3f
fixing linter
Nov 1, 2023
29ef0e3
final fix
Nov 1, 2023
02aaff2
fixing linter
Nov 1, 2023
589467b
fixing logs
Nov 1, 2023
e281cba
Merge branch 'main' of github.com:go-vela/ui into enhance/accessibility
Nov 1, 2023
5b87bf7
Merge branch 'main' into enhance/accessibility
plyr4 Nov 2, 2023
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
49 changes: 28 additions & 21 deletions cypress/integration/a11y.lighttheme.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,41 @@ const A11Y_OPTS = {
type: 'tag',
values: ['section508', 'best-practice', 'wcag21aa', 'wcag2aa'],
},
rules: {
'page-has-heading-one': { enabled: false },
},
};

const elmExclude = '[style*="padding-left: calc(1ch + 6px)"]';

context('Accessibility (a11y)', () => {
context('Logged out', () => {
it.skip('overview', () => {
cy.clearSession();
beforeEach(() => {
cy.server();
cy.route({
method: 'GET',
url: '/token-refresh',
status: 401,
response: { message: 'unauthorized' },
});
});

it('overview', () => {
cy.setTheme('theme-light');
cy.visit('/account/login');
cy.injectAxe();
cy.wait(500);
cy.checkA11y(A11Y_OPTS);
// excludes accessibility testing for Elm pop-up that only appears in Cypress and not on the actual UI
cy.checkA11y({ exclude: [elmExclude] }, A11Y_OPTS);
});
});

context('Logged in', () => {
beforeEach(() => {
cy.clearSession();
cy.setTheme('theme-light');
cy.server();
// overview page
cy.route('GET', '*api/v1/repos*', 'fixture:favorites.json');
cy.route('GET', '*api/v1/user*', 'fixture:favorites.json');
// source repos page
cy.route(
'GET',
Expand Down Expand Up @@ -58,41 +72,34 @@ context('Accessibility (a11y)', () => {
'fixture:build_running.json',
);
});
after(() => {
cy.visit('/');
cy.server({ enable: false });
});

it.skip('overview', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ finally enabled

it('overview', () => {
cy.checkA11yForPage('/', A11Y_OPTS);
});

it.skip('source repos', () => {
it('source repos', () => {
cy.checkA11yForPage('/account/source-repos', A11Y_OPTS);
});

it.skip('settings', () => {
it('settings', () => {
cy.checkA11yForPage('/github/octocat/settings', A11Y_OPTS);
});

it.skip('repo page', () => {
it('repo page', () => {
cy.checkA11yForPage('/github/octocat', A11Y_OPTS);
});

it.skip('hooks page', () => {
cy.login('/github/octocat/hooks');
cy.injectAxe();
cy.wait(500);
cy.get('[data-test=hook]').click({ multiple: true });
cy.checkA11y(A11Y_OPTS);
it('hooks page', () => {
cy.checkA11yForPage('/github/octocat/hooks', A11Y_OPTS);
});

it.skip('build page', () => {
it('build page', () => {
cy.login('/github/octocat/1');
cy.injectAxe();
cy.wait(500);
cy.clickSteps();
cy.checkA11y(A11Y_OPTS);
// excludes accessibility testing for Elm pop-up that only appears in Cypress and not on the actual UI
cy.checkA11y({ exclude: [elmExclude] }, A11Y_OPTS);
});
});
});
43 changes: 27 additions & 16 deletions cypress/integration/a11y.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,36 @@ const A11Y_OPTS = {
type: 'tag',
values: ['section508', 'best-practice', 'wcag21aa', 'wcag2aa'],
},
rules: {
'page-has-heading-one': { enabled: false },
},
};

const elmExclude = '[style*="padding-left: calc(1ch + 6px)"]';

context('Accessibility (a11y)', () => {
context('Logged out', () => {
it.skip('overview', () => {
cy.clearSession();
beforeEach(() => {
cy.server();
cy.route({
method: 'GET',
url: '/token-refresh',
status: 401,
response: { message: 'unauthorized' },
});
});

it('overview', () => {
cy.visit('/account/login');
cy.injectAxe();
cy.wait(500);
cy.checkA11y(A11Y_OPTS);
// excludes accessibility testing for Elm pop-up that only appears in Cypress and not on the actual UI
cy.checkA11y({ exclude: [elmExclude] }, A11Y_OPTS);
});
});

context('Logged in', () => {
beforeEach(() => {
cy.clearSession();
cy.server();
// overview page
cy.route('GET', '*api/v1/user*', 'fixture:favorites.json');
Expand Down Expand Up @@ -57,36 +71,33 @@ context('Accessibility (a11y)', () => {
);
});

it.skip('overview', () => {
it('overview', () => {
cy.checkA11yForPage('/', A11Y_OPTS);
});

it.skip('source repos', () => {
it('source repos', () => {
cy.checkA11yForPage('/account/source-repos', A11Y_OPTS);
});

it.skip('settings', () => {
it('settings', () => {
cy.checkA11yForPage('/github/octocat/settings', A11Y_OPTS);
});

it.skip('repo page', () => {
it('repo page', () => {
cy.checkA11yForPage('/github/octocat', A11Y_OPTS);
});

it.skip('hooks page', () => {
cy.login('/github/octocat/hooks');
cy.injectAxe();
cy.wait(500);
cy.get('[data-test=hook]').click({ multiple: true });
cy.checkA11y(A11Y_OPTS);
it('hooks page', () => {
cy.checkA11yForPage('/github/octocat/hooks', A11Y_OPTS);
});

it.skip('build page', () => {
it('build page', () => {
cy.login('/github/octocat/1');
cy.injectAxe();
cy.wait(500);
cy.clickSteps();
cy.checkA11y(A11Y_OPTS);
// excludes accessibility testing for Elm pop-up that only appears in Cypress and not on the actual UI
cy.checkA11y({ exclude: [elmExclude] }, A11Y_OPTS);
});
});
});
3 changes: 2 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ Cypress.Commands.add('checkA11yForPage', (path = '/', opts = {}) => {
cy.login(path);
cy.injectAxe();
cy.wait(500);
cy.checkA11y(opts);
// excludes accessibility testing for Elm pop-up that only appears in Cypress and not on the actual UI
cy.checkA11y({ exclude: ['[style*="padding-left: calc(1ch + 6px)"]'] }, opts);
});

Cypress.Commands.add('setTheme', theme => {
Expand Down
1 change: 0 additions & 1 deletion src/elm/Help/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ help args =
(class "details"
:: class "help"
:: class "-no-pad"
:: attribute "role" "button"
:: Util.open args.show
)
[ summary
Expand Down
4 changes: 2 additions & 2 deletions src/elm/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2992,7 +2992,7 @@ viewHeader session { feedbackLink, docsLink, theme, help, showId } =

identityAttributeList : List (Html.Attribute Msg)
identityAttributeList =
attribute "role" "navigation" :: Util.open showId
Util.open showId
in
header []
[ div [ class "identity", id "identity", Util.testAttribute "identity" ]
Expand All @@ -3016,7 +3016,7 @@ viewHeader session { feedbackLink, docsLink, theme, help, showId } =
details (identityBaseClassList :: identityAttributeList)
[ summary [ class "summary", Util.onClickPreventDefault (ShowHideIdentity Nothing), Util.testAttribute "identity-summary" ] [ text "Vela" ] ]
]
, nav [ class "help-links", attribute "role" "navigation" ]
, nav [ class "help-links" ]
[ ul []
[ li [] [ viewThemeToggle theme ]
, li [] [ a [ href feedbackLink, attribute "aria-label" "go to feedback" ] [ text "feedback" ] ]
Expand Down
8 changes: 4 additions & 4 deletions src/elm/Pages/Build/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ viewPreview msgs openMenu showMenu now zone org repo showTimestamp build =

buildMenuAttributeList : List (Html.Attribute msg)
buildMenuAttributeList =
[ attribute "role" "navigation", id "build-actions" ] ++ Util.open (List.member build.id openMenu)
Util.open (List.member build.id openMenu) ++ [ id "build-actions" ]

restartBuild : Html msgs
restartBuild =
Expand Down Expand Up @@ -196,7 +196,7 @@ viewPreview msgs openMenu showMenu now zone org repo showTimestamp build =
details (buildMenuBaseClassList :: buildMenuAttributeList)
[ summary [ class "summary", Util.onClickPreventDefault (msgs.toggle (Just build.id) Nothing), Util.testAttribute "build-menu" ]
[ text "Actions"
, FeatherIcons.chevronDown |> FeatherIcons.withSize 20 |> FeatherIcons.withClass "details-icon-expand" |> FeatherIcons.toHtml []
, FeatherIcons.chevronDown |> FeatherIcons.withSize 20 |> FeatherIcons.withClass "details-icon-expand" |> FeatherIcons.toHtml [ attribute "aria-label" "show build actions" ]
]
, ul [ class "build-menu", attribute "aria-hidden" "true", attribute "role" "menu" ]
[ restartBuild
Expand Down Expand Up @@ -445,7 +445,7 @@ viewStepDetails model msgs rm step =
[ div [ class "-name" ] [ text step.name ]
, div [ class "-duration" ] [ text <| Util.formatRunTime model.time step.started step.finished ]
]
, FeatherIcons.chevronDown |> FeatherIcons.withSize 20 |> FeatherIcons.withClass "details-icon-expand" |> FeatherIcons.toHtml []
, FeatherIcons.chevronDown |> FeatherIcons.withSize 20 |> FeatherIcons.withClass "details-icon-expand" |> FeatherIcons.toHtml [ attribute "aria-label" "show build actions" ]
]
, div [ class "logs-container" ] [ viewStepLogs msgs.logsMsgs model.shift rm step ]
]
Expand Down Expand Up @@ -1060,7 +1060,7 @@ followButton followStep resourceType number following =
, onClick <| followStep toFollow
, attribute "aria-label" <| tooltip ++ " for " ++ resourceType ++ " " ++ number
]
[ icon |> FeatherIcons.toHtml [ attribute "role" "img" ] ]
[ icon |> FeatherIcons.toHtml [ attribute "role" "img", attribute "aria-label" "show build actions" ] ]


{-| viewResourceError : checks for build error and renders message
Expand Down
9 changes: 1 addition & 8 deletions src/elm/Pages/Hooks.elm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ hooksToRows now hooks org repo redeliverHook =
-}
tableHeaders : Table.Columns
tableHeaders =
[ ( Just "-icon", "" )
[ ( Just "-icon", "Status" )
, ( Nothing, "source" )
, ( Nothing, "created" )
, ( Nothing, "host" )
Expand All @@ -136,44 +136,37 @@ renderHook now org repo redeliverHook hook =
tr [ Util.testAttribute <| "hooks-row", hookStatusToRowClass hook.status ]
[ td
[ attribute "data-label" "status"
, scope "row"
, class "break-word"
, class "-icon"
]
[ hookStatusToIcon hook.status ]
, td
[ attribute "data-label" "source-id"
, scope "row"
, class "no-wrap"
]
[ small [] [ code [ class "source-id", class "break-word" ] [ text hook.source_id ] ] ]
, td
[ attribute "data-label" "created"
, scope "row"
, class "break-word"
]
[ text <| (Util.relativeTimeNoSeconds now <| Time.millisToPosix <| Util.secondsToMillis hook.created) ]
, td
[ attribute "data-label" "host"
, scope "row"
, class "break-word"
]
[ text hook.host ]
, td
[ attribute "data-label" "event"
, scope "row"
, class "break-word"
]
[ text hook.event ]
, td
[ attribute "data-label" "branch"
, scope "row"
, class "break-word"
]
[ text hook.branch ]
, td
[ attribute "data-label" ""
, scope "row"
, class "break-word"
]
[ a
Expand Down
1 change: 1 addition & 0 deletions src/elm/Pages/RepoSettings.elm
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ badge repo velaAPI velaURL copyMsg =
[ class "form-control"
, class "copy-display"
, class "-is-expanded"
, attribute "aria-label" "status badge markdown code"
, rows 2
, readonly True
, wrap "soft"
Expand Down
6 changes: 3 additions & 3 deletions src/elm/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ homeSearchBar filter search =
, onInput search
]
[]
, FeatherIcons.filter |> FeatherIcons.toHtml [ attribute "role" "img" ]
, FeatherIcons.filter |> FeatherIcons.toHtml [ attribute "aria-label" "filter" ]
]


Expand All @@ -74,7 +74,7 @@ repoSearchBarGlobal searchFilters search =
, id "global-search-input"
]
[]
, FeatherIcons.filter |> FeatherIcons.toHtml [ attribute "role" "img" ]
, FeatherIcons.filter |> FeatherIcons.toHtml [ attribute "aria-label" "filter" ]
]


Expand All @@ -93,7 +93,7 @@ repoSearchBarLocal searchFilters org search =
, onInput <| search org
]
[]
, FeatherIcons.filter |> FeatherIcons.toHtml [ attribute "role" "img" ]
, FeatherIcons.filter |> FeatherIcons.toHtml [ attribute "aria-label" "filter" ]
]


Expand Down
2 changes: 1 addition & 1 deletion src/scss/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ nav {
}

&:last-child {
color: var(--color-bg-dark);
color: var(--color-offwhite);
font-weight: bold;

background-color: var(--color-lavender);
Expand Down
8 changes: 7 additions & 1 deletion src/scss/_themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ body.theme-light {
}

.theme-light {
.navigation a,
.table-base a,
.logs-header .button.-link {
color: var(--color-lavender-dark);
}

.status.success {
color: var(--color-green-dark);
}
Expand Down Expand Up @@ -162,6 +168,6 @@ body.theme-light {
}

.table-base .error-content {
color: var(--color-red);
color: var(--color-red-darkest);
}
}
3 changes: 3 additions & 0 deletions src/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
--color-cyan-semi-dark: hsl(192, 100%, 38%);
--color-cyan: hsl(192, 100%, 50%); // good for text on coal
--color-cyan-light: hsl(192, 100%, 65%);
--color-cyan-lightest: hsl(192, 100%, 81%);
--color-lavender-dark: hsl(286, 29%, 40%);
--color-lavender: hsl(286, 29%, 51%); // good for text on offwhite
--color-lavender-light: hsl(286, 29%, 65%); // good for text on coal
Expand All @@ -18,8 +19,10 @@
--color-offwhite: hsl(0, 0%, 98%); // main light bg
--color-gray: hsl(0, 0%, 70%);
--color-gray-light: hsl(0, 0%, 85%);
--color-gray-lightest: hsl(0, 0%, 94%);

// status indications
--color-red-darkest: hsl(353, 90%, 20%);
--color-red-dark: hsl(353, 77%, 40%);
--color-red: hsl(353, 77%, 50%); // passes contrast on light bg
--color-red-light: hsl(353, 77%, 66%); // passes contrast on coal bg
Expand Down
Loading