Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added aria-label to toolbar icons #1010

Merged
merged 3 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/viewer/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ async function initUIcomponents() {
title: 'Home',
type: 'btn', // btn/check/dropdown
value: 'home',
ariaLabel: 'Home',
callback: goHome,
});
}
Expand All @@ -447,6 +448,7 @@ async function initUIcomponents() {
icon: 'create', // material icons' name
title: 'Draw',
type: 'multistates',
ariaLabel: 'Draw',
callback: draw,
});

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

Expand All @@ -466,6 +469,7 @@ async function initUIcomponents() {
title: 'Magnifier',
type: 'dropdown',
value: 'magn',
ariaLabel: 'Magnifier',
dropdownList: [
{
value: 0.5,
Expand All @@ -491,17 +495,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 @@ -514,6 +521,7 @@ async function initUIcomponents() {
title: 'Download Selection',
type: 'check',
value: 'download',
ariaLabel: 'Download selection',
callback: toggleDownloadSelection,
});
// enhance
Expand All @@ -523,27 +531,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 @@ -556,6 +569,7 @@ async function initUIcomponents() {
title: 'Share View',
type: 'btn',
value: 'share',
ariaLabel: 'Share',
callback: shareURL,
});
}
Expand All @@ -566,6 +580,7 @@ async function initUIcomponents() {
title: 'Side By Side Viewer',
value: 'dbviewers',
type: 'check',
ariaLabel: 'Side by side viewer',
callback: toggleViewerMode,
});
// heatmap
Expand All @@ -575,6 +590,7 @@ async function initUIcomponents() {
title: 'Heat Map',
value: 'heatmap',
type: 'btn',
ariaLabel: 'Heat map',
callback: openHeatmap,
});
subToolsOpt.push({
Expand All @@ -583,6 +599,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 @@ -593,6 +610,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 @@ -608,6 +626,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 @@ -626,6 +645,7 @@ async function initUIcomponents() {
title: 'Download Marks',
type: 'btn',
value: 'download',
ariaLabel: 'Download marks',
callback: Store.prototype.DownloadMarksToFile,
});
subToolsOpt.push({
Expand All @@ -634,6 +654,7 @@ async function initUIcomponents() {
title: 'Load Marks',
type: 'btn',
value: 'upload',
ariaLabel: 'Load marks',
callback: Store.prototype.LoadMarksFromFile,
});
}
Expand All @@ -647,6 +668,7 @@ async function initUIcomponents() {
title: 'has reviewed',
type: 'btn',
value: 'review',
ariaLabel: 'Has reviewed',
callback: updateSlideView,
});
}
Expand All @@ -657,6 +679,7 @@ async function initUIcomponents() {
title: 'Slide Capture',
type: 'btn',
value: 'slCap',
ariaLabel: 'Slide capture',
callback: captureSlide,
});
subToolsOpt.push({
Expand All @@ -665,6 +688,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
Loading