Skip to content

Commit f7039ba

Browse files
committed
Wire WAYF tooltip aria handlers
# If applied, this commit will Wire the generic tooltip ARIA handlers into the WAYF callback, add a Cypress regression test for the remember-choice tooltip toggle, and restore the spec to run fully by removing a stray it.only. # Why is this change needed? Prior to this change, the WAYF remember-choice tooltip never updated its aria-hidden and aria-expanded state when the label was clicked, so assistive technology received incorrect state. # How does it address the issue? This change invokes the existing tooltip accessibility handlers during WAYF initialization and adds a regression test that checks the ARIA state changes. # Provide links to any relevant tickets, articles or other resources Found during review of PR #2095.
1 parent d02163f commit f7039ba

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎tests/e2e/cypress/integration/skeune/wayf/wayf.general.spec.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ context('WAYF behaviour not tied to mouse / keyboard navigation', () => {
6262
.should('have.length', 1);
6363
});
6464

65-
it.only('Shows the global site notice', () => {
65+
it('Shows the global site notice', () => {
6666
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?showGlobalSiteNotice=1');
6767
cy.beVisible(siteNoticeSelector);
6868
});
@@ -221,6 +221,15 @@ context('WAYF behaviour not tied to mouse / keyboard navigation', () => {
221221
cy.get(rememberChoiceTooltipValueSelector).should('not.be.visible');
222222
});
223223

224+
it('Toggles aria-hidden and aria-expanded on the tooltip when the label is clicked', () => {
225+
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?connectedIdps=5&rememberChoiceFeature=true&rememberChoicePerIdp=true');
226+
cy.get(rememberChoiceTooltipValueSelector).should('have.attr', 'aria-hidden', 'true');
227+
cy.get(rememberChoiceTooltipToggleSelector).should('have.attr', 'aria-expanded', 'false');
228+
cy.get('.wayf__rememberChoice label.tooltip').click();
229+
cy.get(rememberChoiceTooltipValueSelector).should('not.have.attr', 'aria-hidden');
230+
cy.get(rememberChoiceTooltipToggleSelector).should('have.attr', 'aria-expanded', 'true');
231+
});
232+
224233
it('Does not show the tooltip toggle for the global (non per-SP) variant', () => {
225234
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?connectedIdps=5&rememberChoiceFeature=true&rememberChoicePerIdp=false');
226235
cy.get(`.${rememberChoicePerIdpClass}`).should('not.exist');

‎theme/base/javascripts/handlers.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@ export const wayfCallbackAfterLoad = () => {
8282
wayfKeyboardBehaviour();
8383
mouseBehaviour();
8484
searchBehaviour();
85+
addTooltipAndModalAriaHandlers(tooltipsAndModalLabels);
86+
toggleTooltipPressedStates();
8587
};
86-

0 commit comments

Comments
 (0)