fix: Add ARIA attributes and roles to print disability dynamic section #11560
Conversation
9ab795a to
0140821
Compare
|
Hi @jimchamp ! I know maintainers are busy, but I wanted to check in on this PR. |
jimchamp
left a comment
There was a problem hiding this comment.
Thanks @mystic-06, and apologies for the delay.
This mostly looks good. Please update the code to use kebab case for any new HTML classes or IDs. The guards that you have added should also be removed.
| if (!rpdCheckbox || !pdaSelector) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
| if (!rpdCheckbox || !pdaSelector) { | |
| return; | |
| } |
Why did you add this? The checkbox and selector are always present in the registration form.
There was a problem hiding this comment.
I originally added the guards because they were needed to keep the existing test cases passing, but I’ll remove them as suggested.
| if (!rpdCheckbox || !pdaSelectorContainer) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
| if (!rpdCheckbox || !pdaSelectorContainer) { | |
| return; | |
| } |
| <input type="checkbox" id="pd_request" name="pd_request"/> | ||
| <label for="pd_request">$:_('I want to apply* for <a href="https://help.archive.org/help/program-overview/" target="_blank">special print disability access</a> through a qualifying program.')</label> | ||
| <input type="checkbox" id="pd_request" name="pd_request" aria-expanded="false" aria-controls="pda-selector"/> | ||
| <label for="pd_request" id="pd_request_label">$:_('I want to apply* for <a href="https://help.archive.org/help/program-overview/" target="_blank">special print disability access</a> through a qualifying program.')</label> |
There was a problem hiding this comment.
| <label for="pd_request" id="pd_request_label">$:_('I want to apply* for <a href="https://help.archive.org/help/program-overview/" target="_blank">special print disability access</a> through a qualifying program.')</label> | |
| <label for="pd_request" id="pd-request-label">$:_('I want to apply* for <a href="https://help.archive.org/help/program-overview/" target="_blank">special print disability access</a> through a qualifying program.')</label> |
HTML class names and IDs should be written using kebab-case.
| <div id="pda-selector" class="ol-signup-form__select hidden"> | ||
| <div class="ol-signup-form__error" id="pd_programMessage"></div> | ||
| <select id="pd_program" name="pd_program" aria-label="$_('Select qualifying program')"> | ||
| <div id="pda-selector" class="ol-signup-form__select hidden" role="region" aria-labelledby="pd_request_label" aria-hidden="true"> |
There was a problem hiding this comment.
| <div id="pda-selector" class="ol-signup-form__select hidden" role="region" aria-labelledby="pd_request_label" aria-hidden="true"> | |
| <div id="pda-selector" class="ol-signup-form__select hidden" role="region" aria-labelledby="pd-request-label" aria-hidden="true"> |
| if (pdaSelector) { | ||
| pdaSelector.setAttribute('aria-required', 'true') | ||
| } |
There was a problem hiding this comment.
| if (pdaSelector) { | |
| pdaSelector.setAttribute('aria-required', 'true') | |
| } | |
| pdaSelector.setAttribute('aria-required', 'true') |
| if (pdaSelector) { | ||
| pdaSelector.setAttribute('aria-required', 'false') | ||
| } |
There was a problem hiding this comment.
| if (pdaSelector) { | |
| pdaSelector.setAttribute('aria-required', 'false') | |
| } | |
| pdaSelector.setAttribute('aria-required', 'false') |
|
Thanks for the review and for the feedback! |
d1ab706 to
380be2f
Compare
380be2f to
495fc6b
Compare
jimchamp
left a comment
There was a problem hiding this comment.
Once again, sorry for the massive delay. The signup.test.js file needs some updates in order for the tests to pass. Using git apply with the following diff will fix the test cases:
diff --git a/tests/unit/js/signup.test.js b/tests/unit/js/signup.test.js
index 5314c2dac..de61b41b0 100644
--- a/tests/unit/js/signup.test.js
+++ b/tests/unit/js/signup.test.js
@@ -13,10 +13,14 @@ beforeEach(() => {
<label for="password">Password</label>
<input type="password" id="password">
<div id="rpd-checkbox" class="ol-signup-form__checkbox">
- <input id="pd_request" type="checkbox">
- <label for="pd_request">PD Checkbox</label>
+ <input id="pd-request" type="checkbox">
+ <label for="pd-request">PD Checkbox</label>
+ </div>
+ <div id="pda-selector" class="ol-signup-form__select hidden">
+ <select id="pd_program" name="pd_program" aria-label="$_('Select qualifying program')" aria-describedby="pd-program-advisory" aria-invalid="false" aria-required="false">
+ <option value="" disabled selected>"Select qualifying program"</option>
+ </select>
</div>
- <div id="pda-selector" class="ol-signup-form__select hidden"></div>
</form>
`;
});
@@ -223,7 +227,7 @@ describe('Print disability tests', () => {
beforeEach(() => {
initSignupForm();
- checkbox = document.querySelector('#pd_request');
+ checkbox = document.querySelector('#pd-request');
selector = document.querySelector('#pda-selector')
})Once that's done, the tests will pass and I'll be happy to merge this. Thanks for your patience and good work!
73395f3 to
079d73d
Compare
|
Thanks for the feedback! I’ve fixed the related tests. Please let me know if anything else needs tweaking. |
…n on the registration page
for more information, see https://pre-commit.ci
079d73d to
1e4b83d
Compare
|
Hi @jimchamp ! Just checking on the status of this PR — please let me know if anything is needed from my side. Thanks! |
Closes #10801
Fix
Technical
aria-expandedandaria-controlsto the print disability checkboxrole="region",aria-hidden, andaria-labelledbyto the dropdown containeraria-describedby,aria-required, andaria-invalidto the program selectorrole="alert"+aria-live="polite"for error messagingTesting