fix label accessibility issue in firefox

deepsource-autofix-76c6eb20
Dan Gowans 2023-01-26 09:46:56 -05:00
parent 4a4e579384
commit 6c8a13c346
4 changed files with 11 additions and 8 deletions

View File

@ -16,6 +16,7 @@
"dev:live": "cross-env NODE_ENV=dev DEBUG=lot-occupancy-system:* nodemon ./bin/www.js",
"cy:open": "cypress open --config-file cypress.config.js",
"cy:run": "cypress run --config-file cypress.config.js",
"cy:run:firefox": "cypress run --config-file cypress.config.js --browser firefox",
"test": "cross-env NODE_ENV=dev DEBUG=lot-occupancy-system:* TEST_DATABASES=true mocha --timeout 30000 --exit",
"coverage": "cross-env NODE_ENV=dev DEBUG=lot-occupancy-system:* TEST_DATABASES=true c8 --reporter=lcov --reporter=text --reporter=text-summary mocha --timeout 30000 --exit",
"temp:legacy:importFromCsv": "cross-env NODE_ENV=dev DEBUG=lot-occupancy-system:* TEST_DATABASES=true node ./temp/legacy.importFromCsv.js",

View File

@ -80,7 +80,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
displayMode: 'dialog'
};
function initializeDatePickers(containerElement) {
var _a;
var _a, _b;
const dateElements = containerElement.querySelectorAll("input[type='date']");
for (const dateElement of dateElements) {
const datePickerOptions = Object.assign({}, datePickerBaseOptions);
@ -125,7 +125,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
else {
clearButtonElement.dataset.tooltip = 'Clear';
clearButtonElement.ariaLabel = 'Clear';
clearButtonElement.setAttribute('aria-label', 'Clear');
clearButtonElement.innerHTML =
'<span class="has-text-weight-bold" aria-hidden="true">&times;</span>';
}
@ -133,7 +133,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
// Apply a label
const labelElement = document.querySelector("label[for='" + dateElement.id + "']");
if (labelElement !== null) {
datepickerElement.querySelector('.datetimepicker-dummy-input').ariaLabel = labelElement.textContent;
datepickerElement
.querySelector('.datetimepicker-dummy-input')
.setAttribute('aria-label', (_b = labelElement.textContent) !== null && _b !== void 0 ? _b : '');
}
}
}

View File

@ -181,7 +181,7 @@ declare const bulmaJS: BulmaJS
clearButtonElement.remove()
} else {
clearButtonElement.dataset.tooltip = 'Clear'
clearButtonElement.ariaLabel = 'Clear'
clearButtonElement.setAttribute('aria-label', 'Clear')
clearButtonElement.innerHTML =
'<span class="has-text-weight-bold" aria-hidden="true">&times;</span>'
}
@ -193,9 +193,9 @@ declare const bulmaJS: BulmaJS
)
if (labelElement !== null) {
datepickerElement.querySelector(
'.datetimepicker-dummy-input'
)!.ariaLabel = labelElement.textContent
datepickerElement
.querySelector('.datetimepicker-dummy-input')!
.setAttribute('aria-label', labelElement.textContent ?? '')
}
}
}

File diff suppressed because one or more lines are too long