-
Couldn't load subscription status.
- Fork 1
A11y cleanup #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
A11y cleanup #8
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ae0bf7
wip
bbenjamin 9e17d77
general a11y cleanup changes
bbenjamin 0dc1f85
tooltip association not needed
bbenjamin 50207bf
add listbox role after render
bbenjamin 9c90e5e
add @todo
bbenjamin ededb71
ul changes only need to happen on mount
bbenjamin 6c375fc
remove onUpdated
bbenjamin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,15 @@ | |
| <HelpText :items="toolbarHelpText" /> | ||
| <div class="ckeditor5-toolbar-disabled"> | ||
| <div class="ckeditor5-toolbar-available"> | ||
| <label for="ckeditor5-toolbar-available__buttons">Available buttons</label> | ||
| <label id="ckeditor5-toolbar-available__buttons-label">Available buttons</label> | ||
| <draggable | ||
| class="ckeditor5-toolbar-tray ckeditor5-toolbar-available__buttons" | ||
| tag="ul" | ||
| :list="listAvailable" | ||
| group="toolbar" | ||
| itemKey="id" | ||
| @add="onAddToAvailable" | ||
| data-button-list="ckeditor5-toolbar-available__buttons" | ||
| > | ||
| <template #item="{ element }"> | ||
| <ToolbarButton | ||
|
|
@@ -25,14 +26,15 @@ | |
| </draggable> | ||
| </div> | ||
| <div class="ckeditor5-toolbar-divider"> | ||
| <label for="ckeditor5-toolbar-divider__buttons">Button divider</label> | ||
| <label id="ckeditor5-toolbar-divider__buttons-label">Button divider</label> | ||
| <draggable | ||
| class="ckeditor5-toolbar-tray ckeditor5-toolbar-divider__buttons" | ||
| tag="ul" | ||
| :list="listDividers" | ||
| :group="{ name: 'toolbar', put: false, pull: 'clone', sort: 'false' }" | ||
| itemKey="id" | ||
| :clone="makeCopy" | ||
| data-button-list="ckeditor5-toolbar-divider__buttons" | ||
| > | ||
| <template #item="{ element }"> | ||
| <ToolbarButton | ||
|
|
@@ -51,13 +53,14 @@ | |
| </div> | ||
| </div> | ||
| <div class="ckeditor5-toolbar-active"> | ||
| <label for="ckeditor5-toolbar-active__buttons">Active toolbar</label> | ||
| <label id="ckeditor5-toolbar-active__buttons-label">Active toolbar</label> | ||
| <draggable | ||
| class="ckeditor5-toolbar-tray ckeditor5-toolbar-active__buttons" | ||
| tag="ul" | ||
| :list="listSelected" | ||
| group="toolbar" | ||
| itemKey="id" | ||
| data-button-list="ckeditor5-toolbar-active__buttons" | ||
| > | ||
| <template #item="{ element }"> | ||
| <ToolbarButton | ||
|
|
@@ -78,7 +81,7 @@ | |
| </template> | ||
|
|
||
| <script setup> | ||
| import { computed, defineProps, shallowReactive, watch } from 'vue'; | ||
| import { computed, defineProps, shallowReactive, watch, onMounted } from 'vue'; | ||
| import draggable from 'vuedraggable'; | ||
| import ToolbarButton from './components/ToolbarButton.vue'; | ||
| import HelpText from './components/HelpText.vue'; | ||
|
|
@@ -167,11 +170,29 @@ const selectedItems = computed( | |
| () => `[${listSelected.map((item) => `"${item.name}"`).join(',')}]`, | ||
| ); | ||
|
|
||
|
|
||
| // Update textarea | ||
| watch( | ||
| () => selectedItems.value, | ||
| (currSelected, prevSelected) => { | ||
| parser.setSelected(currSelected); | ||
| }, | ||
| ); | ||
|
|
||
| // @todo add these attributes directly to the sortable list when | ||
| // https://github.com/SortableJS/vue.draggable.next/pull/35 lands. | ||
| // onMounted and onUpdated can be removed as well if their only purpose is | ||
| // calling this function. | ||
| const updateRoles = () => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add a todo to refactor this if SortableJS/vue.draggable.next#35 ever lands? |
||
| document.querySelectorAll('[data-button-list]').forEach((list) => { | ||
| const buttonListId = list.getAttribute('data-button-list'); | ||
| list.setAttribute('role', 'listbox'); | ||
| list.setAttribute('aria-orientation', 'horizontal'); | ||
| list.setAttribute('aria-labelledby', `${buttonListId}-label`) | ||
| }); | ||
| } | ||
|
|
||
| onMounted(() => { | ||
| updateRoles() | ||
| }); | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, now this is the label that the list is
labelled-byThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the
forattribute in a label only works with 'labelable' elements https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Form_labelable so this needs to use aria-labelledby