From 9f4e11279fedd2c4fafd647f8305220f68ec3ad7 Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 10:58:58 +0100 Subject: [PATCH 01/15] altTitle provided for menu button aria label --- templates/boxMenuItem.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/boxMenuItem.jsx b/templates/boxMenuItem.jsx index eb05bf3..db870e0 100644 --- a/templates/boxMenuItem.jsx +++ b/templates/boxMenuItem.jsx @@ -14,6 +14,7 @@ export default function BoxMenuItem (props) { _isLocked, _isComplete, title, + altTitle, _isOptional, _nthChild, _totalChild @@ -31,8 +32,9 @@ export default function BoxMenuItem (props) { const locked = _isLocked ? _globals?._accessibility?._ariaLabels?.locked : linkText; const optional = _isOptional ? _globals?._accessibility?._ariaLabels?.optional : ''; const itemCount = compile(_globals?._menu?._boxMenu?.itemCount || '', { _nthChild, _totalChild }); + const itemTitle = altTitle || title; const ariaLabel = [ - completion, locked, `${title}.`, `${itemCount}.`, `${optional}` + completion, locked, `${itemTitle}.`, `${itemCount}.`, `${optional}` ].filter(Boolean).join(' '); return ( From 57876511c76de43b9831078e7c4329f8a0501a93 Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 11:00:09 +0100 Subject: [PATCH 02/15] altTitle added to contentObjects example --- example.json | 1 + 1 file changed, 1 insertion(+) diff --git a/example.json b/example.json index 6bd8e4c..434f87c 100644 --- a/example.json +++ b/example.json @@ -50,6 +50,7 @@ "_isHidden": false, "title": "Welcome to Adapt Learning", "displayTitle": "Welcome to Adapt Learning", + "altTitle": "", "body": "This page contains a working Adapt page with all core bundled components and plugins working.", "_graphic": { "alt": "", From f865d6a29c824c742d3c8cc14fcbaa97ca30727b Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 11:01:33 +0100 Subject: [PATCH 03/15] altTitle added to properties.schema --- properties.schema | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/properties.schema b/properties.schema index e94566a..30400a0 100644 --- a/properties.schema +++ b/properties.schema @@ -289,6 +289,15 @@ "type": "object", "required": false, "properties": { + "altTitle": { + "type": "string", + "inputType": "Text", + "validators": [], + "title": "Alternative Title", + "help": "Alternative text read out by screen readers for the menu button text" + "required": false, + "translatable": true + }, "_renderAsGroup": { "type": "boolean", "required": false, From b3ac64417409b7927f3b2df7f486d627377921fd Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 11:02:34 +0100 Subject: [PATCH 04/15] altTitle added to contentobject.schema --- schema/contentobject.schema.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/schema/contentobject.schema.json b/schema/contentobject.schema.json index faa8bba..bf34e4d 100644 --- a/schema/contentobject.schema.json +++ b/schema/contentobject.schema.json @@ -13,6 +13,15 @@ "title": "Box Menu", "default": {}, "properties": { + "altTitle": { + "type": "string", + "title": "Alternative Title", + "description": "Alternative text read out by screen readers for the menu button text", + "default": "", + "_adapt": { + "translatable": true + } + }, "_renderAsGroup": { "type": "boolean", "title": "Make this a parent group of menu items", From 63a3b22e99ae2ec20718445b5e007445a58e2b87 Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 11:03:47 +0100 Subject: [PATCH 05/15] altTitle added to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5290488..ce479f4 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,8 @@ The following attributes, set within *contentObjects.json*, configure the defaul **displayTitle** (string): This text is displayed on the menu item. +>**altTitle** (string): This will be read out by screen readers instead of **title** for the menu button text. Use if **title** contains punctuation or html syntax that shouldn't be read. + **body** (string): Optional text that appears on the menu item. Often used to inform the learner about the menu choice. If no **pageBody** is supplied, this text will also appear as the body text of the page header. **pageBody** (string): Optional text that appears as the body text of the page header. If this text is not provided, the **body** text will be used (if it is supplied). Reference [*adapt-contrib-vanilla/templates/page.hbs*](https://github.com/adaptlearning/adapt-contrib-vanilla/blob/master/templates/page.hbs). From 331300f6cab1996c0f3b592a64ee7c5ee2a7652e Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 14:16:44 +0100 Subject: [PATCH 06/15] replace menu item altTitle with titleAriaLabel ...altTitle is already a supported contentObject property used to provide an alternative on screen title for PLP https://github.com/adaptlearning/adapt-contrib-pageLevelProgress/pull/208 --- templates/boxMenuItem.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/boxMenuItem.jsx b/templates/boxMenuItem.jsx index db870e0..2d475ec 100644 --- a/templates/boxMenuItem.jsx +++ b/templates/boxMenuItem.jsx @@ -14,7 +14,7 @@ export default function BoxMenuItem (props) { _isLocked, _isComplete, title, - altTitle, + titleAriaLabel, _isOptional, _nthChild, _totalChild @@ -32,7 +32,7 @@ export default function BoxMenuItem (props) { const locked = _isLocked ? _globals?._accessibility?._ariaLabels?.locked : linkText; const optional = _isOptional ? _globals?._accessibility?._ariaLabels?.optional : ''; const itemCount = compile(_globals?._menu?._boxMenu?.itemCount || '', { _nthChild, _totalChild }); - const itemTitle = altTitle || title; + const itemTitle = titleAriaLabel || title; const ariaLabel = [ completion, locked, `${itemTitle}.`, `${itemCount}.`, `${optional}` ].filter(Boolean).join(' '); From 4b93fee387225c7e250a403cdeef9dc05519f88c Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 14:17:20 +0100 Subject: [PATCH 07/15] Update properties.schema --- properties.schema | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/properties.schema b/properties.schema index 30400a0..beceef1 100644 --- a/properties.schema +++ b/properties.schema @@ -289,12 +289,12 @@ "type": "object", "required": false, "properties": { - "altTitle": { + "titleAriaLabel": { "type": "string", "inputType": "Text", "validators": [], - "title": "Alternative Title", - "help": "Alternative text read out by screen readers for the menu button text" + "title": "Title ARIA label", + "help": "Alternative title text read out by screen readers for the menu button text" "required": false, "translatable": true }, From f18fc2c326ce0e1c1768f0b4e28776caef1ba752 Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 14:18:02 +0100 Subject: [PATCH 08/15] Update contentobject.schema.json --- schema/contentobject.schema.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/contentobject.schema.json b/schema/contentobject.schema.json index bf34e4d..aa067ac 100644 --- a/schema/contentobject.schema.json +++ b/schema/contentobject.schema.json @@ -13,10 +13,10 @@ "title": "Box Menu", "default": {}, "properties": { - "altTitle": { + "titleAriaLabel": { "type": "string", - "title": "Alternative Title", - "description": "Alternative text read out by screen readers for the menu button text", + "title": "Title ARIA label", + "description": "Alternative title text read out by screen readers for the menu button text", "default": "", "_adapt": { "translatable": true From d82c3f00b7d739d55924a7dae7bee87c9458b2d7 Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 14:18:40 +0100 Subject: [PATCH 09/15] Update example --- example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.json b/example.json index 434f87c..ee549bf 100644 --- a/example.json +++ b/example.json @@ -50,7 +50,7 @@ "_isHidden": false, "title": "Welcome to Adapt Learning", "displayTitle": "Welcome to Adapt Learning", - "altTitle": "", + "titleAriaLabel": "", "body": "This page contains a working Adapt page with all core bundled components and plugins working.", "_graphic": { "alt": "", From 00e53669750fc0c67c4237ffc68a29b80c3da9d3 Mon Sep 17 00:00:00 2001 From: kirsty-hames Date: Wed, 2 Apr 2025 14:19:51 +0100 Subject: [PATCH 10/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce479f4..1b51151 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ The following attributes, set within *contentObjects.json*, configure the defaul **displayTitle** (string): This text is displayed on the menu item. ->**altTitle** (string): This will be read out by screen readers instead of **title** for the menu button text. Use if **title** contains punctuation or html syntax that shouldn't be read. +>**titleAriaLabel** (string): This will be read out by screen readers instead of **title** for the menu button text. Use if **title** contains punctuation or html syntax that shouldn't be read. **body** (string): Optional text that appears on the menu item. Often used to inform the learner about the menu choice. If no **pageBody** is supplied, this text will also appear as the body text of the page header. From 30d1e971fd941d8b735468bd8a48931c82fd619b Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Thu, 1 May 2025 09:39:29 -0600 Subject: [PATCH 11/15] Add missing comma in schema --- properties.schema | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/properties.schema b/properties.schema index beceef1..acd87f1 100644 --- a/properties.schema +++ b/properties.schema @@ -294,7 +294,7 @@ "inputType": "Text", "validators": [], "title": "Title ARIA label", - "help": "Alternative title text read out by screen readers for the menu button text" + "help": "Alternative title text read out by screen readers for the menu button text", "required": false, "translatable": true }, From 50433c932d794f445b13b694738cc57288d84b04 Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Mon, 7 Jul 2025 11:22:17 +0100 Subject: [PATCH 12/15] migration script added, master merged in for package changes --- migrations/v7.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 migrations/v7.js diff --git a/migrations/v7.js b/migrations/v7.js new file mode 100644 index 0000000..bba700b --- /dev/null +++ b/migrations/v7.js @@ -0,0 +1,52 @@ +import { describe, getCourse, whereContent, whereFromPlugin, mutateContent, checkContent, updatePlugin, testStopWhere, testSuccessWhere } from 'adapt-migrations'; +import _ from 'lodash'; + +function getBoxMenus(content) { + return content.filter(({ _type, _component }) => + (_type === 'menu' || _type === 'course') && + (!_component || _component === 'boxMenu')); +} + +describe('Box menu - v@@CURRENT_VERSION to v@@RELEASE_VERSION', async () => { + let boxMenus + + whereFromPlugin('Box menu - from v@@CURRENT_VERSION', { name: 'adapt-contrib-boxMenu', version: '<@@RELEASE_VERSION' }); + + whereContent('Box menu - where boxMenus', async (content) => { + boxMenus = getBoxMenus(content).filter(({ _boxMenu }) => _boxMenu); + return boxMenus.length; + }); + + mutateContent('Box menu - add titleAriaLabel to contentObjects', async (content) => { + boxMenus.titleAriaLabel = ""; + return true; + }); + + checkContent('Box menu - check titleAriaLabel to contentObjects', async (content) => { + const isValid = boxMenus.every(menu => _.has(menu, 'titleAriaLabel')); + if (!isValid) throw new Error('Box menu - global attribute titleAriaLabel'); + return true; + }); + + updatePlugin('Box menu - update to v@@RELEASE_VERSION', { name: 'adapt-contrib-boxMenu', version: '@@RELEASE_VERSION', framework: '">=5.48.4' }); + + testSuccessWhere('Multiple boxMenu, both course and menu', { + fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '@@CURRENT_VERSION' }], + content: [ + { _type: 'course', _boxMenu: { _backgroundImage: {} } }, + { _type: 'menu', _boxMenu: { _backgroundImage: {} } }, + { _type: 'menu', _boxMenu: {} } + ] + }); + + testSuccessWhere('boxMenu with course globals', { + fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '@@CURRENT_VERSION' }], + content: [ + { _type: 'course', _globals: { _menu: { _boxMenu: {} } } } + ] + }); + + testStopWhere('incorrect version', { + fromPlugins: [{ name: 'adapt-contrib-boxMenu', version: '@@RELEASE_VERSION' }] + }); +}); From a92213fb4ba0bd0e5cf24a5dc6fd5a2f262f18eb Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Thu, 9 Oct 2025 16:03:45 -0600 Subject: [PATCH 13/15] Strings must use singlequote --- migrations/v7.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/v7.js b/migrations/v7.js index bba700b..566d864 100644 --- a/migrations/v7.js +++ b/migrations/v7.js @@ -18,7 +18,7 @@ describe('Box menu - v@@CURRENT_VERSION to v@@RELEASE_VERSION', async () => { }); mutateContent('Box menu - add titleAriaLabel to contentObjects', async (content) => { - boxMenus.titleAriaLabel = ""; + boxMenus.titleAriaLabel = ''; return true; }); From a8ca577082a9474ccf747a1a6e789679dc7e26a9 Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Thu, 9 Oct 2025 16:03:58 -0600 Subject: [PATCH 14/15] Remove unused getCourse --- migrations/v7.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/v7.js b/migrations/v7.js index 566d864..f5c953a 100644 --- a/migrations/v7.js +++ b/migrations/v7.js @@ -1,4 +1,4 @@ -import { describe, getCourse, whereContent, whereFromPlugin, mutateContent, checkContent, updatePlugin, testStopWhere, testSuccessWhere } from 'adapt-migrations'; +import { describe, whereContent, whereFromPlugin, mutateContent, checkContent, updatePlugin, testStopWhere, testSuccessWhere } from 'adapt-migrations'; import _ from 'lodash'; function getBoxMenus(content) { From 107b39e47945862f8ab329799193b1c938c1f34c Mon Sep 17 00:00:00 2001 From: Brad Simpson Date: Thu, 9 Oct 2025 16:04:12 -0600 Subject: [PATCH 15/15] Add missing semicolon --- migrations/v7.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/v7.js b/migrations/v7.js index f5c953a..c5fc123 100644 --- a/migrations/v7.js +++ b/migrations/v7.js @@ -8,7 +8,7 @@ function getBoxMenus(content) { } describe('Box menu - v@@CURRENT_VERSION to v@@RELEASE_VERSION', async () => { - let boxMenus + let boxMenus; whereFromPlugin('Box menu - from v@@CURRENT_VERSION', { name: 'adapt-contrib-boxMenu', version: '<@@RELEASE_VERSION' });