Skip to content

Start-/EndAdornments for Input fields (React Material) - #2655

Open
jgteske wants to merge 6 commits into
eclipsesource:masterfrom
jgteske:feat-react-material-adornments
Open

jgteske wants to merge 6 commits into
eclipsesource:masterfrom
jgteske:feat-react-material-adornments

Conversation

@jgteske

@jgteske jgteske commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2018

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 289481d
🔍 Latest deploy log https://app.netlify.com/projects/jsonforms-examples/deploys/6aec862abd61901580bcb112
😎 Deploy Preview https://deploy-preview-2655--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coveralls

coveralls commented Oct 21, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.866% (+0.06%) from 84.803% — jgteske:feat-react-material-adornments into eclipsesource:master

@lucas-koehler

Copy link
Copy Markdown
Contributor

@EclipseSourceAI

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review.

This review was done by an AI agent and therefore may contain mistakes. Feel free to ignore any comment you disagree with. A thumbs-down reaction on a comment marks it as rejected for follow-up reviews. Noting why in a reply helps, since replies are read too.

Resolving all AI comments does not lead to an automatic approval. A maintainer still needs to review and sign off on the overall architecture and design.

To get an updated review after pushing changes, a maintainer may re-request a review from this account.

Running in Eclipse Enclave, submitted via review-guard-mcp

This PR adds startAdornment / endAdornment UI schema options (plain strings) to the React Material text, number, integer, number-format, select, autocomplete and anyOf-string-or-enum inputs (closes #2018). A new useInputAdornments hook in util/adornment.tsx builds MUI InputAdornments and sets notched for the outlined variant. MaterialInputControl force-shrinks the label when a start adornment is set, because MUI can't detect the adornment through the wrapped inner component. Existing built-in end adornments (clear button, autocomplete popup icons, anyOf datalist) are merged with the user adornment, not replaced. The PR also adds an example and a test suite.

The integration is consistent. Every Material input reads the options the same way, and the existing behaviour without the options is unchanged (the clear button logic is equivalent when no end adornment is set). Points for maintainers:

  • Clear button layout in MuiInputText: when an end adornment is set, the clear button permanently reserves space, which leaves a visible gap (inline comment).
  • Public API naming: the hook, isAdornmentText and the new types become public API through the util re-export. One of the types has the same name as a MUI type (inline comment).
  • Label shrink vs. notched: the two are handled in different places (MaterialInputControl vs. the hook). They have to stay in sync for the outlined notch to look right.
  • Example scope: the new "Adornments" example is shared, so it shows up in all renderer sets, but only React Material supports the options.

I couldn't do UI verification: the review sandbox has no network access, so the deploy preview couldn't be loaded and dependencies couldn't be installed for a local build. A maintainer should check the visual result in the deploy preview, especially the select arrow offset (mr: 4) and the outlined label notch.

@lucas-koehler

lucas-koehler commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Hi @jgteske , thank you for the contribution ❤️
The initial AI review seems to make sensible comments to me. Please have a look at them. I will review this in detail afterwards.

@jgteske

jgteske commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Hi @lucas-koehler,
the suggestions of the AI review are valide and changes already implemented. It should be ready for your review. Thanks!

@jgteske
jgteske force-pushed the feat-react-material-adornments branch from 4548711 to cce74a7 Compare November 4, 2026 14:39

@lucas-koehler lucas-koehler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jgteske ,
thanks for the updates! I have some inline comments. Besides that we should consider the placement of the endadornment vs control buttons again:

IMO the clear button, which only shows up on hover, should be left of the end adornment to avoid leaving a blank gap while it is not shown. For instance, see the current state of the autocomplete control in the adornments example:

no hover:
Image

hovered:
Image

The dropdown arrow should stay on the right end in my opinion. The same should be checked for select controls. In the example, they are not clearable. Please check if they can be clearable.

In general, the order on the right should be:
clear - end adornment - other buttons (dropdown arrow)

If that is too complicated, having the end adornment completely on the right (after the other buttons) would be fine, too. It should be consistent over all affected renderers though.

} from '../util';

// MUI positions the dropdown arrow absolutely, so it would cover the end adornment otherwise
const adornmentSx: InputAdornmentSx = { endAdornmentSx: { mr: 4 } };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same ordering issue as in the autocomplete: the dropdown arrow should sit before the suffix, like the clear button in the text field.

Also, mr: 4 goes through theme.spacing. With createTheme({ spacing: 4 }) it resolves to 16px, and the outlined/filled arrow (right: 7px, 24px wide) then overlaps the adornment. A fixed px value avoids that (the standard variant has the arrow at right: 0, so it differs per variant anyway).

@jgteske jgteske Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a small inconsistency between this issue and the generally described Autocomplete issues:
one requests clear - suffix - dropdown arrow (Autocomplete), while the other asks for dropdown arrow - suffix (Select).

MUI’s Autocomplete customization guidance recommends preserving the supplied input props and built-in adornments when adding custom content. Following that principle, I recommend keeping the standard controls together for the AutoComplete and appending the suffix here as well to make it consistent with the Select: clear - dropdown arrow - suffix. This will also make the implementation simpler and less likely to break in the future.

@jgteske

jgteske commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi @lucas-koehler,
thanks for your review!
In my opinion both orders are valide options. My initial intention was to have the end adornment directly "linked" with the input.
But I agree, that the white gap can be a bit confusing this way. I will change the order and check your inline comments.

@jgteske
jgteske force-pushed the feat-react-material-adornments branch from e479a6e to 289481d Compare November 5, 2026 13:35

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Start-/EndAdornments for Input fields

4 participants