Skip to content

Commit fedbbf3

Browse files
committed
Handle Enter on WAYF tooltip toggle
# If applied, this commit will Make the remember-choice tooltip open when its label is focused and Enter is pressed, and add a Cypress regression test for that keyboard interaction. # Why is this change needed? Prior to this change, pressing Enter on the focused WAYF tooltip label did nothing because the Enter handler ignored tooltip labels. # How does it address the issue? This change routes tooltip labels through the existing click helper in the WAYF Enter handler so the keyboard interaction follows the same path as a mouse click. # Provide links to any relevant tickets, articles or other resources Found during review of PR #2095.
1 parent ac266df commit fedbbf3

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ context('WAYF behaviour not tied to mouse / keyboard navigation', () => {
230230
cy.get(rememberChoiceTooltipToggleSelector).should('have.attr', 'aria-expanded', 'true');
231231
});
232232

233+
it('Opens the tooltip when the label is focused and Enter is pressed', () => {
234+
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?connectedIdps=5&rememberChoiceFeature=true&rememberChoicePerIdp=true');
235+
cy.get('.wayf__rememberChoice label.tooltip').focus().type('{enter}');
236+
cy.get(rememberChoiceTooltipValueSelector).should('not.have.attr', 'aria-hidden');
237+
});
238+
233239
it('Does not show the tooltip toggle for the global (non per-SP) variant', () => {
234240
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?connectedIdps=5&rememberChoiceFeature=true&rememberChoicePerIdp=false');
235241
cy.get(`.${rememberChoicePerIdpClass}`).should('not.exist');

‎theme/base/javascripts/wayf/handleEnter.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export const handleEnter = (e) => {
4646
selectFirstIdPAndSubmitForm(); break;
4747
case defaultIdpClass:
4848
handleIdpBanner(e); break;
49+
case 'tooltip':
50+
fireClickEvent(e.target); break;
4951
}
5052
});
5153
};

0 commit comments

Comments
 (0)