Feature/cms 1091 ability to move entries to a new section
Description
Adds element index action to move entries between sections.
-
select entries to be moved and trigger the “Move to” action
-
see a modal with a list of compatible sections (sections that have the same entry type(s) as the entries we want to move)
-
choose a section to move to
-
entries are moved to the new section
Notes:
- it’s not possible to move to a single section
- for structures, entries are moved to the end of the new structure as root elements
- if the section entries are moved to has a lower
maxAuthorslimit, no data is changed/lost for the entries, but the next time they’re saved, a validation error will be shown - when an entry is moved, its revisions and drafts are moved too; if their entry type isn’t allowed by the section we’re moving to, you will still be able to see the draft/revision but not apply/revert to it (the same applies to revisions and draft for entry types that were removed from the section); thanks @brianjhanson for adjusting the awesome
craft-tooltipto work with disabled elements!
Related issues
Rather than showing the “Couldn’t find any sections that all selected elements could be moved to.” message in the modal, ideally the “Move to” action is just grayed out ahead of time if there aren’t any other sections with the same entry type.
This should be doable via the validateSelection() method on the action trigger JS.
@gcamacho079, as per our chats, all items except the disabled button focus ring are actioned.
To get the last item from the list to work, I added the live region container and updateLiveRegion method to all modals (via Garnish.Modal) and started using it in my EntryMover, which means other modals could start taking advantage of it.
A few accessibility improvements based on automated and manual testing:
- [x] The
checkboxrole doesn’t communicate the correct interaction pattern. Radio inputs would work better since the selections are exclusive.- [x] Radio inputs should be contained in a
fieldsetwith alegend/aria-labelledbythat references the title of the modal - [x] List markup should be removed as radio group markup should provide the necessary relationship information
- [x] Radio inputs should be contained in a
- [x] The accessible name of the inputs should match the visible name (i.e., the section name). Right now, the label ID that’s referenced via
aria-labelledbydoes not exist, so the name is coming from the inputtitle. - [x] Focus is dropped when an entry is moved. In these instances, focus should probably be moved to the
.elementscontainer. Ensure programmatic focus can be set by adding `tabindex="-1" to the container.