Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,13 @@ describe("VerticalLayout", () => {
expect(wrappers).toHaveLength(2);
expect(wrappers[1]).toBeEmptyDOMElement();
});

test("greys labels of disabled inputs", () => {
renderForm();
const css = Array.from(document.querySelectorAll("style"))
.map((style) => style.textContent)
.join("");
expect(css).toMatch(/:has\(> \.MuiInputBase-root\.Mui-disabled\)/);
expect(css).toMatch(/:has\(input:disabled\)/);
});
});
9 changes: 7 additions & 2 deletions src/components/helpers/jsonforms/layouts/VerticalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ const VerticalLayoutComponent = ({
<Stack
spacing={2}
useFlexGap
// Hidden fields render nothing; drop their wrappers so they add no gap.
sx={{ "& > :empty": { display: "none" } }}
sx={{
// Hidden fields render nothing; drop their wrappers so they add no gap.
"& > :empty": { display: "none" },
// Material renderers disable the input but not its label.
"& .MuiFormControl-root:has(> .MuiInputBase-root.Mui-disabled) > .MuiInputLabel-root, & .MuiFormControlLabel-root:has(input:disabled) > .MuiFormControlLabel-label":
{ color: "text.disabled" },
}}
>
{elements.map((child, index) => (
<div key={`${path}-${index}`}>
Expand Down
Loading