Browse Source

Merge pull request #33394 from nextcloud/fix/fix-370-Label_not_connected_to_form-element_in_file_listing

Connect ```input``` checkbox with corresponding file name via ```aria-describedby```
Julia Kirschenheuter 2 years ago
parent
commit
532ea001a5
1 changed files with 4 additions and 3 deletions
  1. 4 3
      apps/files/js/filelist.js

+ 4 - 3
apps/files/js/filelist.js

@@ -1694,7 +1694,7 @@
 
 				td.append(
 					'<input id="select-' + this.id + '-' + fileData.id +
-					'" type="checkbox" class="selectCheckBox checkbox"/><label for="select-' + this.id + '-' + fileData.id + '">' +
+					'" type="checkbox" class="selectCheckBox checkbox" aria-describedby="innernametext_' + fileData.id + '" /><label for="select-' + this.id + '-' + fileData.id + '">' +
 					'<span class="hidden-visually">' + (fileData.type === 'dir' ?
 						t('files', 'Select directory "{dirName}"', {dirName: name}) :
 						t('files', 'Select file "{fileName}"', {fileName: name})) + '</span>' +
@@ -1744,8 +1744,9 @@
 				basename = name;
 				extension = false;
 			}
-			var nameSpan=$('<span></span>').addClass('nametext');
-			var innernameSpan = $('<span></span>').addClass('innernametext').text(basename).prop('title', basename);
+			var nameSpan=$('<span></span>').addClass('nametext')
+
+			var innernameSpan = $('<span></span>').addClass('innernametext').text(basename).prop('title', basename).prop('id', `innernametext_${fileData.id}`);
 
 
 			var conflictingItems = this.$fileList.find('tr[data-file="' + this._jqSelEscape(name) + '"]');