Settings: Only add label target for checkbox (#57129)

This commit is contained in:
Christopher Leidigh
2018-08-24 01:32:16 -04:00
committed by GitHub
parent 803542327f
commit d200e76c49
@@ -678,11 +678,11 @@ export class SettingsRenderer implements ITreeRenderer {
// Also have to ignore embedded links - too buried to stop propagation
toDispose.push(DOM.addDisposableListener(descriptionElement, DOM.EventType.MOUSE_DOWN, (e) => {
const targetElement = <HTMLElement>e.toElement;
const targetId = descriptionElement.getAttribute('checkboxLabelTargetId');
const targetId = descriptionElement.getAttribute('checkbox-label-target-id');
// Make sure we are not a link and the target ID matches
// Toggle target checkbox
if (targetElement.tagName !== 'A' && targetId === template.checkbox.domNode.id) {
if (targetElement.tagName.toLowerCase() !== 'a' && targetId === template.checkbox.domNode.id) {
template.checkbox.checked = template.checkbox.checked ? false : true;
}
DOM.EventHelper.stop(e);
@@ -949,9 +949,11 @@ export class SettingsRenderer implements ITreeRenderer {
template.descriptionElement.innerText = element.description;
}
// Add checkbox target to description clickable and able to toggle checkbox
const checkbox_id = (element.displayCategory + '_' + element.displayLabel).replace(/ /g, '_') + '_Item';
template.descriptionElement.setAttribute('checkboxLabelTargetId', checkbox_id);
if (templateId === SETTINGS_BOOL_TEMPLATE_ID) {
// Add checkbox target to description clickable and able to toggle checkbox
const checkbox_id = (element.displayCategory + '_' + element.displayLabel).replace(/ /g, '_') + '_Item';
template.descriptionElement.setAttribute('checkbox-label-target-id', checkbox_id);
}
if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ?