Skip to content

[graphiql] Global .monaco-editor .highlight rule recolors every Monaco editor on the page #4766

Done

Description

@ItaiYosephi

@graphiql/react 1.0.2's stylesheet ships an unscoped rule:

.monaco-editor .highlight {
  color: oklch(var(--accent-green)) !important;
}

Monaco uses .highlight for matched characters in the suggest widget, quick input, find widget and references peek. So once GraphiQL's CSS is loaded, every Monaco editor on the page turns those matches green, not just GraphiQL's. Because of the !important, the host app has a hard time undoing it.

In a single-page app the stylesheet stays loaded after you leave the GraphiQL page, so it affects Monaco editors across the whole app.

Could it be scoped to GraphiQL, e.g. .graphiql-container .monaco-editor .highlight, and drop the !important? The .overflow-guard rule next to it has the same problem (#4088).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions