Skip to content

fix layout issue with field input#2264

Merged
google-oss-prow[bot] merged 9 commits intokubeflow:mainfrom
ingridsmoreira:fix-field-layout
Mar 6, 2026
Merged

fix layout issue with field input#2264
google-oss-prow[bot] merged 9 commits intokubeflow:mainfrom
ingridsmoreira:fix-field-layout

Conversation

@ingridsmoreira
Copy link
Contributor

@ingridsmoreira ingridsmoreira commented Feb 23, 2026

Description

Issue: #2263
Wrap the component field in the ThemeAwareFormGroupWrapper
added new optional value to the ThemeAwareFormGroupWrapper because the logic to make it dirty was not correct

Before:
image

After:
image

PF Mode:
image

How Has This Been Tested?

That was manually tested, no tests are added since is just a visible change in UX

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

Signed-off-by: Ingrid Moreira <ingridmoreira@Ingrids-MacBook-Pro.local>
Signed-off-by: Ingrid Moreira <ingridmoreira@Ingrids-MacBook-Pro.local>
Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
Signed-off-by: Ingrid Moreira <ingridmoreira@Ingrids-MacBook-Pro.local>
Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
ingridsmoreira and others added 2 commits February 24, 2026 11:17
…nts/CredentialsSection.tsx

Co-authored-by: Manaswini Das <dasmanaswini10@gmail.com>
Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
…reFormGroupWrapper.tsx

Co-authored-by: Manaswini Das <dasmanaswini10@gmail.com>
Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! The core approach of wrapping the organization field in ThemeAwareFormGroupWrapper is correct.

However, the isInvalid prop feels like a workaround for a design gap in ThemeAwareFormGroupWrapper. The real issue is that the component conflates "has helper text" with "has error" via !!helperTextNode. That works for callers like CreateModal where helperTextNode is conditionally false when there's no error, but breaks here because the organization field bundles always-visible description text with conditional error text into a fragment — and a fragment <>...</> is always truthy.

Instead of adding isInvalid, I'd suggest adding a description prop to ThemeAwareFormGroupWrapper for always-visible help text, keeping helperTextNode strictly for error text. This way !!helperTextNode continues to correctly infer error state, no extra boolean needed.

ThemeAwareFormGroupWrapper.tsx — add description, drop isInvalid, keep hasError = !!helperTextNode:

type ThemeAwareFormGroupWrapperProps = {
  children: React.ReactNode;
  label: string;
  fieldId: string;
  isRequired?: boolean;
  description?: React.ReactNode;    // Always-visible help text
  helperTextNode?: React.ReactNode; // Error-only helper text
  className?: string;
  labelHelp?: React.ReactElement;
  'data-testid'?: string;
};

Then render description after the input (before helperTextNode) in both theme branches:

// MUI theme
<FormGroup ...>
  <FormFieldset component={children} field={label} />
</FormGroup>
{description}
{helperTextNode}

// PF theme
<FormGroup ...>
  {children}
  {description}
  {helperTextNode}
</FormGroup>

CredentialsSection.tsx — split the text, match the pattern used in CreateModal:

const organizationDescription = (
  <FormHelperText>
    <HelperText>
      <HelperTextItem>{HELP_TEXT.ORGANIZATION}</HelperTextItem>
    </HelperText>
  </FormHelperText>
);

const organizationHelperTextNode = isOrganizationTouched && !isOrganizationValid && (
  <FormHelperText>
    <HelperText>
      <HelperTextItem variant="error" data-testid="organization-error">
        {VALIDATION_MESSAGES.ORGANIZATION_REQUIRED}
      </HelperTextItem>
    </HelperText>
  </FormHelperText>
);

<ThemeAwareFormGroupWrapper
  label={FORM_LABELS.ORGANIZATION}
  fieldId="organization"
  isRequired
  description={organizationDescription}
  helperTextNode={organizationHelperTextNode}
>
  {organizationInput}
</ThemeAwareFormGroupWrapper>

This keeps the API clean, avoids duplicating state (isInvalid just mirrors helperTextNode truthiness), and matches the existing pattern used across CreateModal.

Also a minor nit: missing semicolon after the organizationHelperTextNode closing ) on line 83.

@manaswinidas
Copy link
Contributor

manaswinidas commented Feb 24, 2026

@ingridsmoreira also fix the linting issues while you are addressing the review comments - alternatively you can use npm run test on the frontend folder and run the UI - Frontend test suite locally to detect and fix any linting, type check issues, unit and Cypress test failures

Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
@ingridsmoreira
Copy link
Contributor Author

@manaswinidas Thank you for the insights, I added the changes you requested and fixed the lint.

Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

Tested locally - is there a way in which the helpertext appears in the same place as before this change. Right now it is below the input field. Earlier it was above. This also affects the PF theme. The screenshot is taken in Patternfly theme btw

Reading order is wrong. Right now, both description and error render below the input. The description is static guidance the user should see before interacting with the field, so it belongs above the input. The error ("Organization is required") is feedback after interaction, so it should appear immediately below the input - not after the description text.

can we try something like this?

PF theme:
<FormGroup ...>
{descriptionTextNode}
{children}
{helperTextNode}

MUI theme:
<>
<FormGroup ...>
{descriptionTextNode}


{helperTextNode}
</>

This keeps the order as label -> description -> input -> error, and ensures hasError correctly detects the error state to apply pf-m-error.

Image

@ingridsmoreira
Copy link
Contributor Author

ingridsmoreira commented Feb 27, 2026

Tested locally - is there a way in which the helpertext appears in the same place as before this change. Right now it is below the input field. Earlier it was above. This also affects the PF theme. The screenshot is taken in Patternfly theme btw

Reading order is wrong. Right now, both description and error render below the input. The description is static guidance the user should see before interacting with the field, so it belongs above the input. The error ("Organization is required") is feedback after interaction, so it should appear immediately below the input - not after the description text.

can we try something like this?

PF theme: <FormGroup ...> {descriptionTextNode} {children} {helperTextNode}

MUI theme: <> <FormGroup ...> {descriptionTextNode} {helperTextNode} </>

This keeps the order as label -> description -> input -> error, and ensures hasError correctly detects the error state to apply pf-m-error.

Image

Implementing the suggested change in PF mode becomes this:
image
That looks ok.

But for the suggested change in non-PF mode it becomes this:
image

Almost the same issue that opened the bug.

The code of this is this one:

<>
        <FormGroup
          className={`${className || ''} ${hasError ? 'pf-m-error' : ''}`.trim()} // Apply className and error state class
          label={label}
          isRequired={isRequired}
          fieldId={fieldId}
          labelHelp={labelHelp}
          data-testid={dataTestId}
        >
          {descriptionTextNode}
          <FormFieldset component={children} field={label} />
        </FormGroup>
        {helperTextNode}
      </>

If we move the description outside of the FormGroup it becomes like this
image

The code for these changes are this:

<>
        {descriptionTextNode}
        <FormGroup
          className={`${className || ''} ${hasError ? 'pf-m-error' : ''}`.trim()} // Apply className and error state class
          label={label}
          isRequired={isRequired}
          fieldId={fieldId}
          labelHelp={labelHelp}
          data-testid={dataTestId}
        >
          <FormFieldset component={children} field={label} />
        </FormGroup>
        {helperTextNode}
      </>

I will push with this last changes, that looks better(at least to me lol) but let me know your thoughts @manaswinidas and thank you again for the review and suggestions

Signed-off-by: Ingrid Moreira <ingrid.smoreira@hotmail.com>
@jonburdo
Copy link
Member

/ok-to-test

Copy link
Contributor

@Philip-Carneiro Philip-Carneiro left a comment

Choose a reason for hiding this comment

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

On my view, it's good to go, it solve the issue I opened

@google-oss-prow
Copy link
Contributor

@Philip-Carneiro: changing LGTM is restricted to collaborators

Details

In response to this:

On my view, it's good to go, it solve the issue I opnned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

LGTM - just needs a rebase and then I'll approve

@manaswinidas
Copy link
Contributor

The changes look good in both PF theme and MUI theme
Screenshot 2026-03-06 at 6 34 57 PM

@ingridsmoreira
Copy link
Contributor Author

LGTM - just needs a rebase and then I'll approve

Rebased

Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@google-oss-prow google-oss-prow bot added the lgtm label Mar 6, 2026
@google-oss-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: manaswinidas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 855ae56 into kubeflow:main Mar 6, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants