mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-65539 formats: Section labels not updated during move
Before this change when moving a section via drag and drop the aria-label for the section was not being updated neither was the title on the drag handle. The result was the the drop menu on keyboard drag and drop displayed the wrong information after a section was moved.
This commit is contained in:
parent
1d4fdb0d1c
commit
dc489dffe6
@ -48,6 +48,7 @@ M.course.format.swap_sections = function(Y, node1, node2) {
|
||||
* Process sections after ajax response
|
||||
*
|
||||
* @param {YUI} Y YUI3 instance
|
||||
* @param {NodeList} sectionlist of sections
|
||||
* @param {array} response ajax response
|
||||
* @param {string} sectionfrom first affected section
|
||||
* @param {string} sectionto last affected section
|
||||
@ -76,13 +77,14 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
|
||||
// Update section title.
|
||||
var content = Y.Node.create('<span>' + response.sectiontitles[i] + '</span>');
|
||||
sectionlist.item(i).all('.'+CSS.SECTIONNAME).setHTML(content);
|
||||
// Update move icon.
|
||||
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
|
||||
str = ele.getAttribute('alt');
|
||||
// Update the drag handle.
|
||||
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE).ancestor('.section-handle');
|
||||
str = ele.getAttribute('title');
|
||||
stridx = str.lastIndexOf(' ');
|
||||
newstr = str.substr(0, stridx +1) + i;
|
||||
ele.setAttribute('alt', newstr);
|
||||
ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
|
||||
ele.setAttribute('title', newstr);
|
||||
// Update the aria-label for the section.
|
||||
sectionlist.item(i).setAttribute('aria-label', content.get('innerText').trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ M.course.format.swap_sections = function(Y, node1, node2) {
|
||||
* Process sections after ajax response
|
||||
*
|
||||
* @param {YUI} Y YUI3 instance
|
||||
* @param {NodeList} sectionlist of sections
|
||||
* @param {array} response ajax response
|
||||
* @param {string} sectionfrom first affected section
|
||||
* @param {string} sectionto last affected section
|
||||
@ -77,13 +78,14 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
|
||||
var content = Y.Node.create('<span>' + response.sectiontitles[i] + '</span>');
|
||||
sectionlist.item(i).all('.'+CSS.SECTIONNAME).setHTML(content);
|
||||
|
||||
// Update move icon.
|
||||
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
|
||||
str = ele.getAttribute('alt');
|
||||
// Update the drag handle.
|
||||
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE).ancestor('.section-handle');
|
||||
str = ele.getAttribute('title');
|
||||
stridx = str.lastIndexOf(' ');
|
||||
newstr = str.substr(0, stridx +1) + i;
|
||||
ele.setAttribute('alt', newstr);
|
||||
ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
|
||||
ele.setAttribute('title', newstr);
|
||||
// Update the aria-label for the section.
|
||||
sectionlist.item(i).setAttribute('aria-label', content.get('innerText').trim());
|
||||
|
||||
// Remove the current class as section has been moved.
|
||||
sectionlist.item(i).removeClass('current');
|
||||
|
Loading…
x
Reference in New Issue
Block a user