diff --git a/src/form/KaotoForm.scss b/src/form/KaotoForm.scss
index 60eda3b..c5bd671 100644
--- a/src/form/KaotoForm.scss
+++ b/src/form/KaotoForm.scss
@@ -42,6 +42,22 @@
justify-content: space-between;
}
+ &__suggestions-button {
+ display: none;
+ }
+
+ /* stylelint-disable-next-line selector-class-pattern */
+ .pf-v6-c-text-input-group:hover &__suggestions-button,
+ /* stylelint-disable-next-line selector-class-pattern */
+ .pf-v6-c-text-input-group:focus-within &__suggestions-button,
+ /* stylelint-disable-next-line selector-class-pattern */
+ .pf-v6-c-input-group:hover &__suggestions-button,
+ /* stylelint-disable-next-line selector-class-pattern */
+ .pf-v6-c-input-group:focus-within &__suggestions-button,
+ &__suggestions-button:focus {
+ display: inline-flex;
+ }
+
&__empty {
display: none;
}
diff --git a/src/form/KeyValue/KeyValueField.test.tsx b/src/form/KeyValue/KeyValueField.test.tsx
index 2977978..c4f8d77 100644
--- a/src/form/KeyValue/KeyValueField.test.tsx
+++ b/src/form/KeyValue/KeyValueField.test.tsx
@@ -3,7 +3,10 @@ import { KeyValueField } from './KeyValueField';
// Mock useSuggestions to control its output
jest.mock('../hooks/suggestions', () => ({
- useSuggestions: jest.fn(() => null),
+ useSuggestions: jest.fn(() => ({
+ suggestionsMenu: null,
+ openSuggestions: jest.fn(),
+ })),
}));
describe('KeyValueField', () => {
@@ -75,7 +78,10 @@ describe('KeyValueField', () => {
const SuggestionsMenu = () =>
Suggestions
;
const { useSuggestions } = jest.requireMock('../hooks/suggestions');
- useSuggestions.mockImplementation(() => );
+ useSuggestions.mockImplementation(() => ({
+ suggestionsMenu: ,
+ openSuggestions: jest.fn(),
+ }));
const { getByTestId } = render();
const input = getByTestId('keyvalue-input');
diff --git a/src/form/KeyValue/KeyValueField.tsx b/src/form/KeyValue/KeyValueField.tsx
index f1a2aab..b36cbe6 100644
--- a/src/form/KeyValue/KeyValueField.tsx
+++ b/src/form/KeyValue/KeyValueField.tsx
@@ -22,7 +22,7 @@ export const KeyValueField = forwardRef(
useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);
- const suggestions = useSuggestions({
+ const { suggestionsMenu } = useSuggestions({
propName: name,
schema: STRING_SCHEMA,
inputRef,
@@ -47,7 +47,7 @@ export const KeyValueField = forwardRef(
value={value}
/>
- {suggestions}
+ {suggestionsMenu}
);
},
diff --git a/src/form/__snapshots__/KaotoForm.test.tsx.snap b/src/form/__snapshots__/KaotoForm.test.tsx.snap
index d3872ef..6a5abf0 100644
--- a/src/form/__snapshots__/KaotoForm.test.tsx.snap
+++ b/src/form/__snapshots__/KaotoForm.test.tsx.snap
@@ -47,7 +47,7 @@ exports[`KaotoForm should validate the model 1`] = `
+