Skip to content

Webviews don't respect accessibility.unfocusedViewOpacity #189650

Closed as not planned

Description

@Tyriar

This setting works by injecting some CSS here:

const rules = new Set<string>();
// Only add the styles if the feature is used
if (opacity !== 1) {
const filterRule = `filter: opacity(${opacity});`;
// Terminal tabs
rules.add(`.monaco-workbench .pane-body.integrated-terminal:not(:focus-within) .tabs-container { ${filterRule} }`);
// Terminals
rules.add(`.monaco-workbench .pane-body.integrated-terminal .xterm:not(.focus) { ${filterRule} }`);
// Editors
rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${filterRule} }`);
}
elStyle.textContent = [...rules].join('\n');

Webviews aren't part of the regular DOM structure though so I'm not sure the best way to do this. I tried this but it didn't work:

[data-parent-flow-to-element-id^=webview-editor-element] .webview:not(:focus-within) {
    filter: opacity(0.5);
}

I think we need a focused class on the iframe to be able to style this from the main document.

Activity

  1. added
    bug
    accessibility
    webview
    on Aug 4, 2023
  2. added
    help wanted
    on Aug 8, 2023
  3. Tyriar commented on Aug 23, 2023

    @Tyriar
    ContributorAuthor

    That's a bit outside my knowledge, all I know is that webview behave specially and are hosted outside of the editor tab content DOM tree

  4. added
    *out-of-scope
    on Dec 11, 2024
  5. vs-code-engineering commented on Dec 11, 2024

    @vs-code-engineering
    Contributor

    We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

    If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

    Thanks for your understanding, and happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*out-of-scopeaccessibilitybughelp wantedwebview

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions