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
<button>
instead of<a>
.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
media.
Tested all of the toolbar functionality. It all works (except for image
uploads, which is a known problem already).
Summary | ID |
---|---|
38d04d603e76e16f1111f2f0e8948fc5a1272f01 |
-
-
For the image upload button, I'll need to listen to the file
input
'schange
event instead of thebutton
'sclick
event. We should give the toolbar items anEventsHash
type 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. -
- Change Summary:
-
- 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.
- Changed the upload button to make it easier to attach event to the
- Commits:
-
Summary ID fb466905011e1070c101f571b6db189518b04c53 38d04d603e76e16f1111f2f0e8948fc5a1272f01