Skip to content

Commit

Permalink
Merge pull request #1010 from nwanduka/toolbar-icons-name-change
Browse files Browse the repository at this point in the history
Added aria-label to toolbar icons
  • Loading branch information
birm authored Jul 21, 2024
2 parents 1ba9413 + 6dafdf6 commit 1841845
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
24 changes: 24 additions & 0 deletions apps/viewer/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ async function initUIcomponents() {
title: 'Home',
type: 'btn', // btn/check/dropdown
value: 'home',
ariaLabel: 'Home',
callback: goHome,
});
}
Expand All @@ -456,6 +457,7 @@ async function initUIcomponents() {
icon: 'create', // material icons' name
title: 'Draw',
type: 'multistates',
ariaLabel: 'Draw',
callback: draw,
});

Expand All @@ -465,6 +467,7 @@ async function initUIcomponents() {
title: 'Preset Labels',
type: 'check',
value: 'prelabels',
ariaLabel: 'Preset labels',
callback: drawLabel,
});

Expand All @@ -475,6 +478,7 @@ async function initUIcomponents() {
title: 'Magnifier',
type: 'dropdown',
value: 'magn',
ariaLabel: 'Magnifier',
dropdownList: [
{
value: 0.5,
Expand All @@ -500,17 +504,20 @@ async function initUIcomponents() {
title: 'Measurement',
type: 'dropdown',
value: 'measure',
ariaLabel: 'Measurement',
dropdownList: [
{
value: 'straight',
title: 'straight',
icon: 'straighten',
ariaLabel: 'straight',
checked: true,
},
{
value: 'coordinate',
title: 'coordinate',
icon: 'square_foot',
ariaLabel: 'coordinate',
},
],
callback: toggleMeasurement,
Expand All @@ -523,6 +530,7 @@ async function initUIcomponents() {
title: 'Download Selection',
type: 'check',
value: 'download',
ariaLabel: 'Download selection',
callback: toggleDownloadSelection,
});
// enhance
Expand All @@ -532,27 +540,32 @@ async function initUIcomponents() {
title: 'Enhance',
type: 'dropdown',
value: 'Enhance',
ariaLabel: 'Enhance',
dropdownList: [
{
value: 'Histogram Eq',
title: 'Histogram Equalization',
icon: 'leaderboard',
ariaLabel: 'Histogram equalization',
checked: true,
},
{
value: 'Edge',
title: 'Edge',
icon: 'show_chart',
ariaLabel: 'Edge',
},
{
value: 'Sharpen',
title: 'Sharpen',
icon: 'change_history',
ariaLabel: 'Sharpen',
},
{
value: 'Custom',
title: 'Custom',
icon: 'api',
ariaLabel: 'Custom',
},
],
callback: enhance,
Expand All @@ -565,6 +578,7 @@ async function initUIcomponents() {
title: 'Share View',
type: 'btn',
value: 'share',
ariaLabel: 'Share',
callback: shareURL,
});
}
Expand All @@ -575,6 +589,7 @@ async function initUIcomponents() {
title: 'Side By Side Viewer',
value: 'dbviewers',
type: 'check',
ariaLabel: 'Side by side viewer',
callback: toggleViewerMode,
});
// heatmap
Expand All @@ -584,6 +599,7 @@ async function initUIcomponents() {
title: 'Heat Map',
value: 'heatmap',
type: 'btn',
ariaLabel: 'Heat map',
callback: openHeatmap,
});
subToolsOpt.push({
Expand All @@ -592,6 +608,7 @@ async function initUIcomponents() {
title: 'Labeling',
value: 'labeling',
type: 'btn',
ariaLabel: 'Labeling',
callback: function() {
window.location.href = `../labeling/labeling.html${window.location.search}`;
},
Expand All @@ -602,6 +619,7 @@ async function initUIcomponents() {
type: 'btn',
value: 'rect',
title: 'Segment',
ariaLabel: 'Segment',
callback: function() {
if (window.location.search.length > 0) {
window.location.href =
Expand All @@ -617,6 +635,7 @@ async function initUIcomponents() {
type: 'btn',
value: 'rect',
title: 'Predict',
ariaLabel: 'Predict',
callback: function() {
if (window.location.search.length > 0) {
window.location.href = '../model/model.html' + window.location.search;
Expand All @@ -635,6 +654,7 @@ async function initUIcomponents() {
title: 'Download Marks',
type: 'btn',
value: 'download',
ariaLabel: 'Download marks',
callback: Store.prototype.DownloadMarksToFile,
});
subToolsOpt.push({
Expand All @@ -643,6 +663,7 @@ async function initUIcomponents() {
title: 'Load Marks',
type: 'btn',
value: 'upload',
ariaLabel: 'Load marks',
callback: Store.prototype.LoadMarksFromFile,
});
}
Expand All @@ -656,6 +677,7 @@ async function initUIcomponents() {
title: 'has reviewed',
type: 'btn',
value: 'review',
ariaLabel: 'Has reviewed',
callback: updateSlideView,
});
}
Expand All @@ -666,6 +688,7 @@ async function initUIcomponents() {
title: 'Slide Capture',
type: 'btn',
value: 'slCap',
ariaLabel: 'Slide capture',
callback: captureSlide,
});
subToolsOpt.push({
Expand All @@ -674,6 +697,7 @@ async function initUIcomponents() {
title: 'Tutorial',
value: 'tutorial',
type: 'btn',
ariaLabel: 'Tutorial',
callback: function() {
tour.init();
tour.start(true);
Expand Down
7 changes: 7 additions & 0 deletions components/toolbar/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ function CaToolbar(options) {
title: 'Applications',
type: 'check',
value: 'apps',
ariaLabel: 'Applications',
},
{
icon: 'view_list',
title: 'Layers',
type: 'check',
value: 'layers',
ariaLabel: 'Layers',
},
],
};
Expand Down Expand Up @@ -211,6 +213,7 @@ CaToolbar.prototype.__createCheck = function(options) {
icon.classList.add('material-icons');
icon.classList.add('md-24');
icon.textContent = options.icon;
if (options.ariaLabel) icon.ariaLabel = options.ariaLabel;
icon.htmlFor = id;
if (options.title) {
tippy(icon, {
Expand Down Expand Up @@ -273,6 +276,7 @@ CaToolbar.prototype.__createRadio = function(options) {
if (options.icon) {
icon.classList.add('material-icons');
icon.classList.add('md-24');
if (options.ariaLabel) icon.ariaLabel = options.ariaLabel;
icon.textContent = options.icon;
} else {
let _fitContent = 'fit-content';
Expand Down Expand Up @@ -330,6 +334,7 @@ CaToolbar.prototype.__createMultiStateBtns = function(options) {
icon.id = randomId(); // create a timestamp id
icon.classList.add('material-icons');
icon.classList.add('md-24');
if (options.ariaLabel) icon.ariaLabel = options.ariaLabel;
icon.classList.add(0);
icon.dataset.state = 0;
icon.textContent = options.icon;
Expand Down Expand Up @@ -383,6 +388,7 @@ CaToolbar.prototype.__createMultiDropDown = function(options) {
const icon = document.createElement('label');
icon.classList.add('material-icons');
icon.classList.add('md-24');
if (options.ariaLabel) icon.ariaLabel = options.ariaLabel;
icon.textContent = options.icon;
icon.htmlFor = id;
if (options.title) {
Expand Down Expand Up @@ -510,6 +516,7 @@ CaToolbar.prototype.__createDropDown = function(options) {
const icon = document.createElement('label');
icon.classList.add('material-icons');
icon.classList.add('md-24');
if (options.ariaLabel) icon.ariaLabel = options.ariaLabel;
icon.textContent = options.icon;
icon.htmlFor = id;
if (options.title) {
Expand Down

0 comments on commit 1841845

Please sign in to comment.