未验证 提交 d200e76c 编写于 作者: C Christopher Leidigh 提交者: GitHub

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

上级 80354232
...@@ -678,11 +678,11 @@ export class SettingsRenderer implements ITreeRenderer { ...@@ -678,11 +678,11 @@ export class SettingsRenderer implements ITreeRenderer {
// Also have to ignore embedded links - too buried to stop propagation // Also have to ignore embedded links - too buried to stop propagation
toDispose.push(DOM.addDisposableListener(descriptionElement, DOM.EventType.MOUSE_DOWN, (e) => { toDispose.push(DOM.addDisposableListener(descriptionElement, DOM.EventType.MOUSE_DOWN, (e) => {
const targetElement = <HTMLElement>e.toElement; 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 // Make sure we are not a link and the target ID matches
// Toggle target checkbox // 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; template.checkbox.checked = template.checkbox.checked ? false : true;
} }
DOM.EventHelper.stop(e); DOM.EventHelper.stop(e);
...@@ -949,9 +949,11 @@ export class SettingsRenderer implements ITreeRenderer { ...@@ -949,9 +949,11 @@ export class SettingsRenderer implements ITreeRenderer {
template.descriptionElement.innerText = element.description; template.descriptionElement.innerText = element.description;
} }
// Add checkbox target to description clickable and able to toggle checkbox if (templateId === SETTINGS_BOOL_TEMPLATE_ID) {
const checkbox_id = (element.displayCategory + '_' + element.displayLabel).replace(/ /g, '_') + '_Item'; // Add checkbox target to description clickable and able to toggle checkbox
template.descriptionElement.setAttribute('checkboxLabelTargetId', checkbox_id); const checkbox_id = (element.displayCategory + '_' + element.displayLabel).replace(/ /g, '_') + '_Item';
template.descriptionElement.setAttribute('checkbox-label-target-id', checkbox_id);
}
if (element.overriddenScopeList.length) { if (element.overriddenScopeList.length) {
let otherOverridesLabel = element.isConfigured ? let otherOverridesLabel = element.isConfigured ?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册