Enable accessibility and item registration for the formatting toolbar.
Review Request #13212 — Created Aug. 14, 2023 and submitted
This updates the HTML for the formatting toolbar to ensure it's
accessible, enabling screen readers to understand the groups and items
on the toolbar in order to communicate it to the user, and to enable
keyboard navigation. This involves setting ARIA attributes and using
Items are now registered dynamically instead of hard-coded. This is both
to ensure consistent HTML (particularly with accessibility) and to later
allow extensions to add buttons to the toolbar (which was an original
goal of the project).
This does make one minor change to the toolbar contents, which is to mov
the Code button alongside Bold/Italic/Strikethrough. This is because
it's just setting an inline style like those (it's a code literal, not a
code block), and has more in common with those than linking/uploading
Tested all of the toolbar functionality. It all works (except for image
uploads, which is a known problem already).
For the image upload button, I'll need to listen to the file
changeevent instead of the
clickevent. We should give the toolbar items an
EventsHashtype option or something similar that would allow us to set other events and support setting events on specific elements in the
$el, not just the button. This'll give more flexibility to extensions too.
Typo "roup" -> "group"
- Changed the upload button to make it easier to attach event to the
<input>, and removed the default click handler.
- Converted all handlers to ES6 private methods.
- Fixed a typo in an assertion message.
Revision 2 (+594 -96)
Checks run (2 succeeded)