Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Insert link accessibility (WordPress#1933)
* Insert link accessibility ## Description Fixes WordPress#694 by improving the screen reader accessibility of the element. My updates apply to the add link and edit link pop-out elements, handling the following aspects: - The buttons (Apply, Edit, Remove) now have the aria-label attribute added in for accessibility purposes. There is no visual change for them. - The URL input now has an ID that makes use of the withInstanceId feature from components - The URL input now has a screen-reader-text label which uses the ID on the for attribute to improve the screen reader accessibility of the element. This label is not visible. ## How Has This Been Tested? I used the browser's inspector (screenshots reflect that) to confirm the presence of the a11y attributes and screen-reader-text elements on both the add link and edit link forms. The updates done in blocks/editable/format-toolbar.js were visible in the add link / edit existing link workflow in the text block, just like the screenshots show. I wasn't able to figure out where is the "blocks/library/button/index.js" actually used. It has in the edit function a form with a class of editable-format-toolbar__link-modal, just like the one generated with the insert/edit URL. Locally only I tried adding an extra class on the form.editable-format-toolbar__link-modal and trying to hunt it in the browser, but I wasn't able to stumble upon it myself. That's why the changes done on that file are minimal (added the button aria-label and added a <label for> and added an ID to the URL input element itself, without making use of withInstanceId - because there is no export default I could add the withInstanceId call around). ## Screenshots: Add link form:  Edit link form:  ## Types of changes New feature (non-breaking change which adds functionality). ## Checklist: - [x] My code is tested. - [x] My code follows the WordPress code style. * 694 - Fix formatting * 694 - Removed visually hidden labels, added aria-label attribute on the input * 694 - Reverted the edit function declaration * 694 - Dropped accessibility text comment
- Loading branch information