Skip to content

Commit

Permalink
fix(vscode): Hide a11y labels
Browse files Browse the repository at this point in the history
Currently, the a11y labels are visible despite VSCode not being a screen reader.

This happens because some @patternfly css classes are not being loaded when building
for VSCode.

The workaround is to provide the missing class into the KaotoEditor styles.

Fixes: #442
  • Loading branch information
lordrip committed Nov 29, 2023
1 parent 03513df commit 8dcd1c5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions packages/ui/src/multiplying-architecture/KaotoEditor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
flex-grow: 1;
}
}

// Provide a screen reader class to hide elements
// This is a workaround since this class should be provided by the @patternfly/react-core package
.pf-v5-u-screen-reader {
position: fixed;
top: 0;
left: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
3 changes: 2 additions & 1 deletion packages/ui/src/multiplying-architecture/KaotoEditorApp.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@patternfly/react-core/dist/styles/base.css'; // This import needs to be first
import {
Editor,
EditorApi,
Expand All @@ -12,7 +13,7 @@ import { EntitiesProvider } from '../providers/entities.provider';
import { SourceCodeProvider } from '../providers/source-code.provider';
import { KaotoEditor } from './KaotoEditor';

export class KaotoEditorView implements Editor {
export class KaotoEditorApp implements Editor {
private readonly editorRef: RefObject<EditorApi>;
af_isReact = true;
af_componentId = 'kaoto-editor';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { KaotoEditorView } from './KaotoEditorApp';
import { KaotoEditorApp } from './KaotoEditorApp';
import {
Editor,
EditorFactory,
Expand All @@ -12,6 +12,6 @@ export class KaotoEditorFactory implements EditorFactory<Editor, KogitoEditorCha
envelopeContext: KogitoEditorEnvelopeContextType<KogitoEditorChannelApi>,
initArgs: EditorInitArgs,
): Promise<Editor> {
return Promise.resolve(new KaotoEditorView(envelopeContext, initArgs));
return Promise.resolve(new KaotoEditorApp(envelopeContext, initArgs));
}
}

0 comments on commit 8dcd1c5

Please sign in to comment.