Skip to content

feat(vscode): improve accessibility for views and webviews#592

Merged
imran-siddique merged 3 commits intomicrosoft:mainfrom
zeel2104:feat/vscode-a11y-labels
Mar 30, 2026
Merged

feat(vscode): improve accessibility for views and webviews#592
imran-siddique merged 3 commits intomicrosoft:mainfrom
zeel2104:feat/vscode-a11y-labels

Conversation

@zeel2104
Copy link
Copy Markdown
Contributor

Description

Improve accessibility across the VS Code extension views and webviews by adding accessible labels for tree items, better ARIA semantics for webview content, and keyboard interaction support in the workflow designer.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Maintenance (dependency updates, CI/CD, refactoring)
  • Security fix

Package(s) Affected

  • agent-os-kernel
  • agent-mesh
  • agent-runtime
  • agent-sre
  • agent-governance
  • docs / root

Checklist

  • My code follows the project style guidelines (ruff check)
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass (pytest)
  • I have updated documentation as needed
  • I have signed the Microsoft CLA

Related Issues

Closes #527

@github-actions
Copy link
Copy Markdown

Welcome to the Agent Governance Toolkit! Thanks for your first pull request.
Please ensure tests pass, code follows style (ruff check), and you have signed the CLA.
See our Contributing Guide.

@github-actions github-actions Bot added the size/L Large PR (< 500 lines) label Mar 30, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

🤖 AI Agent: docs-sync-checker — Issues Found

📝 Documentation Sync Report

Issues Found

  1. AuditLogItem.formatAccessibilityLabel(entry: AuditEntry) -> str in packages/agent-os-vscode/src/views/auditLogView.ts — missing docstring.
  2. DebuggerItem.getAccessibilityLabel(label: str, data: Optional[Dict[str, Any]]) -> str in packages/agent-os-vscode/src/views/kernelDebuggerView.ts — missing docstring.
  3. MemoryItem.accessibilityInformation in packages/agent-os-vscode/src/views/kernelDebuggerView.ts — missing docstring for the new property.
  4. PolicyItem.accessibilityInformation in packages/agent-os-vscode/src/views/policiesView.ts — missing docstring for the new property.
  5. StatsItem.accessibilityInformation in packages/agent-os-vscode/src/views/statsView.ts — missing docstring for the new property.
  6. ⚠️ packages/agent-os-vscode/README.md — no mention of the new accessibility improvements for views and webviews.
  7. ⚠️ CHANGELOG.md — no entry for the new accessibility improvements in the VS Code extension.

Suggestions

  • 💡 Add docstring for AuditLogItem.formatAccessibilityLabel(entry: AuditEntry) -> str explaining its purpose, parameters, and return value.
  • 💡 Add docstring for DebuggerItem.getAccessibilityLabel(label: str, data: Optional[Dict[str, Any]]) -> str explaining its purpose, parameters, and return value.
  • 💡 Add docstrings for the new accessibilityInformation properties in MemoryItem, PolicyItem, and StatsItem to explain their purpose and structure.
  • 💡 Update packages/agent-os-vscode/README.md to include a section on the new accessibility improvements, such as ARIA roles, labels, and keyboard navigation support.
  • 💡 Add an entry to CHANGELOG.md under a new version heading (e.g., ## [Unreleased]) summarizing the accessibility improvements made to views and webviews.

Additional Notes

  • The changes include significant accessibility improvements, such as adding ARIA roles, labels, and keyboard navigation support. These changes should be documented to inform users and developers about the new features.
  • The example code in the repository does not seem to be affected by the changes, as they primarily involve UI accessibility enhancements rather than API signature changes.

Action Required

Please address the missing docstrings, update the README, and add a CHANGELOG entry to ensure documentation is in sync with the new feature.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

🤖 AI Agent: breaking-change-detector — Summary

🔍 API Compatibility Report

Summary

The recent changes in the microsoft/agent-governance-toolkit repository primarily focus on improving accessibility features in the VS Code extension. These changes include the addition of accessibility information to various UI components. No breaking changes were identified in the public API, as all modifications are additive or enhancements that do not alter existing functionality.

Findings

Severity Package Change Impact
🔵 agent-os-vscode Added accessibilityInformation to AuditLogItem, DebuggerItem, MemoryItem, PolicyItem, StatsItem Enhances accessibility without breaking existing functionality
🔵 agent-os-vscode Introduced new methods for generating accessibility labels New functionality for accessibility, not breaking
🔵 agent-os-vscode Improved ARIA roles and labels in webviews Enhances usability for screen readers, not breaking

Migration Guide

Since no breaking changes were found, there are no migration steps required. However, it is recommended to review the new accessibility features and consider updating any relevant documentation to inform users of the enhancements made.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

🤖 AI Agent: security-scanner — Security Review of PR: feat(vscode): improve accessibility for views and webviews

Security Review of PR: feat(vscode): improve accessibility for views and webviews

This PR focuses on improving accessibility for VS Code extension views and webviews. While the changes are primarily related to accessibility enhancements, a thorough security review is necessary given the critical nature of the repository.


Findings

1. Prompt Injection Defense Bypass

  • Risk: No direct evidence of prompt injection vulnerabilities in this PR. However, the changes include user-facing content (e.g., tooltips, labels, and ARIA attributes) that are dynamically generated based on input data. If these inputs are not sanitized, they could potentially be exploited for injection attacks.
  • Attack Vector: If an attacker can inject malicious content into the entry data (e.g., entry.file, entry.reason, etc.), it could lead to unintended behavior or even XSS in the VS Code webviews.
  • Rating: 🟠 HIGH
  • Recommendation: Ensure that all user-provided or external data used in dynamic content (e.g., entry.file, entry.reason, entry.code) is properly sanitized and escaped before being rendered in the UI. Use libraries like DOMPurify for sanitizing HTML content in webviews.

2. Policy Engine Circumvention

  • Risk: No changes in this PR directly affect the policy engine. However, the PolicyEditorPanel.ts file includes logic for parsing YAML, JSON, and Rego policies. The _parseYamlValue function and related parsing logic could be a potential target for policy circumvention if not handled securely.
  • Attack Vector: Maliciously crafted YAML or JSON content could exploit parsing logic to bypass policy validation or inject unintended behavior.
  • Rating: 🟡 MEDIUM
  • Recommendation: Use a well-maintained library for YAML and JSON parsing (e.g., js-yaml for YAML). Avoid implementing custom parsing logic unless absolutely necessary. Validate and sanitize all policy inputs before processing.

3. Trust Chain Weaknesses

  • Risk: No changes in this PR impact the trust chain or certificate validation mechanisms.
  • Rating: 🔵 LOW

4. Credential Exposure

  • Risk: No evidence of credentials being exposed in logs, error messages, or debug output in this PR.
  • Rating: 🔵 LOW

5. Sandbox Escape

  • Risk: No changes in this PR involve container or process isolation mechanisms.
  • Rating: 🔵 LOW

6. Deserialization Attacks

  • Risk: The _parseYamlValue function in PolicyEditorPanel.ts introduces custom deserialization logic for YAML values. This could be a potential vector for deserialization attacks if the input is not properly validated.
  • Attack Vector: Malicious YAML content could exploit the custom parsing logic to inject unexpected data or behavior.
  • Rating: 🟠 HIGH
  • Recommendation: Avoid custom deserialization logic. Use a secure YAML parsing library like js-yaml and enable safe loading modes (e.g., safeLoad instead of load).

7. Race Conditions

  • Risk: No evidence of race conditions in this PR.
  • Rating: 🔵 LOW

8. Supply Chain

  • Risk: No new dependencies are introduced in this PR. However, existing dependencies should be regularly audited for vulnerabilities.
  • Rating: 🔵 LOW

Summary of Findings

Issue Rating Details
Prompt Injection Defense Bypass 🟠 HIGH Dynamic content generation (e.g., tooltips, labels) may be vulnerable to injection attacks.
Policy Engine Circumvention 🟡 MEDIUM Custom YAML parsing logic could be exploited to bypass policy validation.
Trust Chain Weaknesses 🔵 LOW No changes affecting trust chain or certificate validation.
Credential Exposure 🔵 LOW No evidence of credentials being exposed.
Sandbox Escape 🔵 LOW No changes affecting container or process isolation.
Deserialization Attacks 🟠 HIGH Custom YAML deserialization logic could be exploited.
Race Conditions 🔵 LOW No evidence of race conditions.
Supply Chain 🔵 LOW No new dependencies introduced; existing dependencies should be audited.

Recommendations

  1. Sanitize User Input: Ensure all user-provided or external data used in dynamic content (e.g., tooltips, labels, ARIA attributes) is sanitized and escaped to prevent injection attacks.
  2. Use Secure Parsing Libraries: Replace custom YAML parsing logic with a secure library like js-yaml and enable safe loading modes.
  3. Add Tests for Malicious Inputs: Introduce tests to validate that the application handles malicious inputs (e.g., script injection, malformed YAML) securely.
  4. Conduct Dependency Audit: Perform a dependency audit to ensure no vulnerabilities exist in third-party libraries.

Final Assessment

While this PR primarily focuses on accessibility improvements, it introduces potential security risks due to the use of dynamic content and custom parsing logic. Addressing these issues is critical to maintaining the integrity of the agent governance toolkit.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Agent: code-reviewer

Review of PR: feat(vscode): improve accessibility for views and webviews


Summary

This PR focuses on improving accessibility across the VS Code extension views and webviews by adding accessible labels, better ARIA semantics, and keyboard interaction support. The changes span multiple files and include updates to tree views, webviews, and the onboarding experience.


🔍 Review Findings

1. Accessibility Improvements

  • Tree Items:

    • The addition of accessibilityInformation with label and role properties is a good enhancement for screen readers. This ensures that tree items are accessible and provide meaningful context to users.
    • 💡 SUGGESTION: Consider testing these changes with a screen reader to ensure the labels are descriptive and intuitive for users.
  • Webviews:

    • The use of ARIA roles (e.g., role="group", role="toolbar", role="list") and aria-label attributes improves the semantic structure of the webviews.
    • The addition of aria-live regions (e.g., metricsAnnouncer, validationResults) ensures dynamic content updates are announced to screen readers.
    • 💡 SUGGESTION: For aria-live regions, ensure that the content updates are concise and do not overwhelm the user with excessive information.
  • Keyboard Navigation:

    • The addition of tabindex and focus styles (e.g., :focus-visible) for interactive elements like .template-card is a good step toward improving keyboard accessibility.
    • 💡 SUGGESTION: Test keyboard navigation thoroughly to ensure all interactive elements are reachable and usable.

🔴 CRITICAL Issues

  1. Potential XSS Vulnerability in updateViolations Function

    • The updateViolations function in MetricsDashboardPanel.ts directly injects user-provided data (v.name) into the DOM without sanitization:
      <span class="violation-name">
          <span style="color: #dc3545;">⚠️</span>
          \${v.name.replace(/_/g, ' ')}
      </span>
    • Risk: If v.name contains malicious JavaScript, it could lead to a Cross-Site Scripting (XSS) attack.
    • Action: Use a library like DOMPurify to sanitize user-provided data before injecting it into the DOM.
  2. Insecure Use of innerHTML

    • The updateChart function in MetricsDashboardPanel.ts uses innerHTML to dynamically render chart bars:
      chart.innerHTML = data.map((value, i) => 
          \`<div class="bar" style="height: \${(value / max) * 100}%" data-value="\${value}" aria-hidden="true"></div>\`
      ).join('');
    • Risk: If data contains untrusted input, this could also lead to XSS vulnerabilities.
    • Action: Avoid using innerHTML for dynamic content. Instead, use DOM manipulation methods like document.createElement.

🟡 Warnings

  1. Backward Compatibility
    • The changes in this PR do not appear to introduce breaking changes to the public API. However, the changes to the VS Code extension's UI could potentially impact users who rely on specific UI behaviors.
    • Action: Communicate these changes clearly in the release notes to ensure users are aware of the updates.

💡 Suggestions

  1. Testing for Accessibility

    • While the changes improve accessibility, it is crucial to test the updated UI with screen readers (e.g., NVDA, JAWS, or VoiceOver) and keyboard navigation to ensure the changes work as intended.
  2. Error Handling in YAML Parsing

    • The _parseYamlValue function in PolicyEditorPanel.ts has been updated for better readability, but it lacks robust error handling for invalid YAML values.
    • Action: Add error handling to ensure the function gracefully handles unexpected input.
  3. Code Style

    • The PR includes several changes to improve code readability (e.g., adding braces to if statements). This is a good practice, but ensure consistency across the codebase.
    • Action: Run ruff to verify adherence to the project's style guidelines.
  4. Unit Tests

    • The PR does not include any new tests for the added functionality.
    • Action: Add tests to verify the following:
      • accessibilityInformation is correctly set for tree items.
      • ARIA roles and labels are applied correctly in webviews.
      • Dynamic content updates in aria-live regions are announced as expected.
      • Keyboard navigation works as intended.
  5. Documentation

    • The PR does not mention any updates to documentation.
    • Action: Update the documentation to reflect the new accessibility features and any changes to the UI.

✅ Conclusion

The PR introduces significant accessibility improvements to the VS Code extension, which is a positive step forward. However, there are critical security issues related to potential XSS vulnerabilities that must be addressed before merging. Additionally, testing and documentation updates are recommended to ensure the changes are robust and well-communicated.

Action Items:

  1. 🔴 Address the XSS vulnerabilities in updateViolations and updateChart.
  2. 💡 Add accessibility and keyboard navigation tests.
  3. 💡 Update documentation to reflect the new accessibility features.
  4. 💡 Test the changes with screen readers and keyboard navigation.

Let me know if you need further clarification or assistance!

@zeel2104
Copy link
Copy Markdown
Contributor Author

Local verification completed in packages/agent-os-vscode:

  • npm.cmd run compile
  • npm.cmd run lint (only unrelated pre-existing warnings remain)

Copy link
Copy Markdown
Member

@imran-siddique imran-siddique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - all checks pass.

@imran-siddique imran-siddique enabled auto-merge (squash) March 30, 2026 18:21
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Agent: code-reviewer

Review Summary

This pull request introduces accessibility improvements to the VS Code extension views and webviews. The changes include adding accessible labels for tree items, improving ARIA semantics for webview content, and enhancing keyboard interaction support in the workflow designer. While the changes are generally well-implemented and improve accessibility, there are some areas that require attention to ensure compliance with accessibility standards and maintain code quality.


🔴 CRITICAL

  1. Potential Information Disclosure in Accessibility Labels:

    • In AuditLogItem.formatAccessibilityLabel and DebuggerItem.getAccessibilityLabel, sensitive information such as file paths and reasons for audit entries are being included in the accessibility labels. This could lead to unintended information disclosure, especially if the screen reader is used in a public or shared environment.
    • Recommendation: Review the content being included in the accessibility labels and ensure that sensitive information is either excluded or obfuscated.
  2. Potential XSS Vulnerability in Webviews:

    • In MetricsDashboardPanel.ts, the updateChart function dynamically sets the aria-label attribute for the activityChart element using unescaped user-provided data (data.map((value, hour) => ...)). This could lead to a cross-site scripting (XSS) vulnerability if the data is not properly sanitized.
    • Recommendation: Sanitize the data before injecting it into the DOM. Use a library like DOMPurify or ensure proper escaping of special characters.

🟡 WARNING

  1. Potential Breaking Change in Accessibility Labels:

    • The addition of accessibilityInformation properties to tree items (e.g., AuditLogItem, DebuggerItem, MemoryItem, etc.) may change the behavior of screen readers. If users have workflows or automation relying on the previous behavior, this could be considered a breaking change.
    • Recommendation: Clearly document these changes in the release notes and consider providing a configuration option to toggle the new accessibility features.
  2. Behavioral Change in PolicyEditorPanel:

    • The PolicyEditorPanel now includes additional ARIA attributes and labels for accessibility. While this is a positive change, it may alter the behavior of existing automated tools or scripts that interact with the editor.
    • Recommendation: Document these changes in the release notes and test the updated editor with common screen readers to ensure compatibility.

💡 SUGGESTIONS

  1. Test Coverage:

    • The PR does not include any new tests for the added accessibility features. While these changes are primarily UI-related, it is still important to add tests to ensure that the new ARIA attributes and labels are correctly applied and do not regress in the future.
    • Recommendation: Add tests to verify the presence and correctness of the accessibilityInformation properties and ARIA attributes in the views and webviews.
  2. Code Consistency:

    • The formatting changes (e.g., adding braces to single-line if statements) are good for readability but are inconsistent across the codebase. Some single-line if statements were updated, while others were not.
    • Recommendation: Apply consistent formatting across the entire file or project. Consider using ruff or black to enforce consistent formatting.
  3. Keyboard Navigation Testing:

    • While the PR mentions improved keyboard interaction support in the workflow designer, there is no evidence of testing or documentation for these changes.
    • Recommendation: Test the keyboard navigation thoroughly and document the expected behavior for users. This will also help identify any edge cases or issues.
  4. Use of aria-live:

    • The use of aria-live in the metricsAnnouncer and validationResults elements is a good addition. However, consider specifying the aria-live level (e.g., polite or assertive) explicitly to ensure the desired behavior.
    • Recommendation: Add aria-live="polite" or aria-live="assertive" as appropriate to ensure the screen reader announces updates in the intended manner.
  5. Code Comments:

    • Some of the new methods, such as AuditLogItem.formatAccessibilityLabel and DebuggerItem.getAccessibilityLabel, lack comments explaining their purpose and usage.
    • Recommendation: Add comments to these methods to improve code readability and maintainability.
  6. Documentation Update:

    • The PR does not include updates to the documentation, even though it introduces new accessibility features and potentially changes behavior.
    • Recommendation: Update the documentation to include details about the new accessibility features and any changes to existing behavior.

Summary of Actions Required

  1. 🔴 Address potential information disclosure in accessibility labels.
  2. 🔴 Sanitize user-provided data to prevent XSS vulnerabilities in webviews.
  3. 🟡 Document potential breaking changes in accessibility behavior.
  4. 💡 Add tests for accessibility features and keyboard navigation.
  5. 💡 Ensure consistent code formatting across the project.
  6. 💡 Specify aria-live levels explicitly.
  7. 💡 Add comments to new methods for better code clarity.
  8. 💡 Update documentation to reflect new accessibility features and changes.

Let me know if you need further clarification or assistance!

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Agent: code-reviewer

Review Summary

This pull request introduces accessibility improvements to the VS Code extension views and webviews in the agent-os-vscode package. The changes include adding accessible labels for tree items, improving ARIA semantics for webview content, and enhancing keyboard interaction support in the workflow designer. While the changes are generally well-implemented, there are some areas that require attention to ensure compliance with accessibility standards, maintain code quality, and avoid potential regressions.


🔴 CRITICAL

  1. Potential Security Risk in MetricsDashboardPanel

    • The updateChart function dynamically sets the aria-label attribute of the activityChart element using unsanitized data from the data array. This could lead to a Cross-Site Scripting (XSS) vulnerability if the data array contains malicious input.
    • Recommendation: Sanitize the data array before using it to set the aria-label attribute. Consider using a library like DOMPurify or implementing a custom sanitization function.
    chart.setAttribute(
        'aria-label',
        'Activity by hour. ' +
        data.map((value, hour) => `${hour}:00 has ${value} events`).join('. ')
    );
  2. Inconsistent ARIA Roles in MetricsDashboardPanel

    • The role="group" attribute is used for the cards in the metrics dashboard (e.g., "Blocked operations today"). However, the group role is typically used for grouping interactive elements, which these cards are not.
    • Recommendation: Replace role="group" with role="region" or remove the role attribute entirely if grouping is unnecessary.

🟡 WARNING

  1. Backward Compatibility
    • The addition of accessibilityInformation to the TreeItem objects in the VS Code extension may affect users who rely on custom extensions or scripts that interact with these objects. While this is unlikely to break functionality, it is worth noting as a potential breaking change.
    • Recommendation: Document this change in the release notes to inform users of the new behavior.

💡 SUGGESTIONS

  1. Unit Tests for Accessibility Features

    • While the PR mentions adding accessible labels and ARIA roles, there are no corresponding tests to verify these changes.
    • Recommendation: Add unit tests to ensure that the accessibilityInformation properties and ARIA attributes are correctly applied. This could involve mocking the VS Code API and verifying the expected behavior.
  2. Code Readability

    • Several functions, such as formatTooltip and _parseYamlValue, have been updated to include additional checks or formatting. While these changes improve readability, they could benefit from further refactoring to reduce repetition.
    • Recommendation: Extract common patterns into helper functions to improve maintainability.

    Example for _parseYamlValue:

    private static _parseYamlValue(value: string): any {
        const mappings = {
            'true': true,
            'false': false,
            'null': null,
        };
        if (value in mappings) return mappings[value];
        if (/^\d+$/.test(value)) return parseInt(value, 10);
        if (/^\d+\.\d+$/.test(value)) return parseFloat(value);
        if (/^["'].*["']$/.test(value)) return value.slice(1, -1);
        return value;
    }
  3. Keyboard Navigation

    • While the PR adds ARIA roles and labels, it does not address keyboard navigation for interactive elements like buttons and dropdowns.
    • Recommendation: Ensure that all interactive elements are keyboard-navigable and provide visual focus indicators.
  4. Documentation Updates

    • The PR does not include updates to the documentation to reflect the new accessibility features.
    • Recommendation: Update the documentation to describe the new accessibility features and how developers can leverage them.
  5. Code Style

    • The PR includes several instances of inconsistent formatting, such as missing spaces around operators and inconsistent use of single vs. double quotes in JavaScript.
    • Recommendation: Run the code through the ruff linter to ensure consistency with the project's style guidelines.
  6. Performance Optimization

    • The updateChart function dynamically updates the aria-label and inner HTML of the activityChart element. This could lead to performance issues if the data array is large.
    • Recommendation: Consider throttling or debouncing the updateChart function to reduce the frequency of DOM updates.

Summary of Actionable Feedback

  1. 🔴 Sanitize user input in updateChart to prevent XSS vulnerabilities.
  2. 🔴 Review and correct the use of ARIA roles, especially role="group" in MetricsDashboardPanel.
  3. 🟡 Document the addition of accessibilityInformation as a potential breaking change.
  4. 💡 Add unit tests for accessibility features.
  5. 💡 Refactor repetitive code in functions like _parseYamlValue for maintainability.
  6. 💡 Ensure keyboard navigability and focus indicators for all interactive elements.
  7. 💡 Update documentation to include new accessibility features.
  8. 💡 Run the code through the ruff linter to ensure consistent formatting.
  9. 💡 Optimize the updateChart function to handle large datasets more efficiently.

Let me know if you need further clarification or assistance!

@imran-siddique imran-siddique merged commit 584a2db into microsoft:main Mar 30, 2026
58 of 61 checks passed
imran-siddique added a commit to imran-siddique/agent-governance-toolkit that referenced this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR (< 500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add accessibility labels to VSCode extension views

2 participants