MGMT-21261: keep link to pull secret visible#3138
Conversation
Signed-off-by: Elay Aharoni <elayaha@gmail.com>
|
@ElayAharoni: This pull request references MGMT-21261 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
WalkthroughRefactors TextAreaField helper text rendering: splits the previous single conditional HelperTextItem into two independent conditionals. Renders an error HelperTextItem when errorMessage exists and a default HelperTextItem when helperText exists. aria-describedby remains set to Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant C as TextAreaField
participant H as HelperTextItem
U->>C: Render TextAreaField(props)
alt errorMessage present
C->>H: Render error HelperTextItem\n(id: {fieldId}-helper-error,\nvariant: error,\nicon: ExclamationCircleIcon,\ncontent: errorMessage)
end
alt helperText present
C->>H: Render default HelperTextItem\n(id: {fieldId}-helper,\nvariant: default,\ncontent: helperText)
end
note over C: textarea aria-describedby={fieldId}-helper
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@ElayAharoni: This pull request references MGMT-21261 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
libs/ui-lib/lib/common/components/ui/formik/TextAreaField.tsx (2)
56-56: Accessibility: aria-describedby does not reference the error message id.When an error is shown, the field still points only to
${fieldId}-helper. IfhelperTextis absent, aria-describedby points to a non-existent element; if present, screen readers won’t announce the error text. Include the error id (and helper id if present) in aria-describedby, with error first.Apply this diff to line 56:
- aria-describedby={`${fieldId}-helper`} + aria-describedby={ + [errorMessage && `${fieldId}-helper-error`, helperText && `${fieldId}-helper`] + .filter(Boolean) + .join(' ') || undefined + }Optional (further a11y enhancement): also wire aria-errormessage for explicit error association.
validated={isValid ? 'default' : 'error'} isRequired={isRequired} - aria-describedby={`${fieldId}-helper`} + aria-describedby={ + [errorMessage && `${fieldId}-helper-error`, helperText && `${fieldId}-helper`] + .filter(Boolean) + .join(' ') || undefined + } + aria-errormessage={!isValid && errorMessage ? `${fieldId}-helper-error` : undefined}
57-57: Formik integration bug: onChange handler receives (value, event), but forwards only a value-like argument to field.onChange(event).PatternFly TextArea calls onChange with (value, event). Passing the first argument straight into Formik’s field.onChange (which expects a React event) can break updates. Prefer setValue.
Proposed fix:
- const [field, { touched, error }] = useField(props.name); + const [field, { touched, error }, helpers] = useField(props.name); ... - onChange={(event) => field.onChange(event)} + onChange={(value) => helpers.setValue(value)}This keeps blur handling from
{...field}intact and ensures the Formik state updates correctly with PF’s value-first signature.
🧹 Nitpick comments (2)
libs/ui-lib/lib/common/components/ui/formik/TextAreaField.tsx (2)
58-58: API consistency: use PatternFly’s isDisabled prop instead of disabled.Using the HTML
disabledattribute works because it’s passed through, but PF components conventionally exposeisDisabled. This improves consistency and readability across the codebase.- disabled={isDisabled} + isDisabled={isDisabled}
60-79: Consider making the helper region a live description for error changes.With both helper and error items rendered, announcements will happen on focus due to describedby, but dynamic updates may not be announced. If you observe SRs not announcing changes, consider adding an aria-live="polite" to the error HelperTextItem or using PF props that render an alert role (if available in your PF version).
Example (only if your PF version forwards unknown props to the item’s container):
- <HelperTextItem + <HelperTextItem + aria-live="polite" icon={<ExclamationCircleIcon />} variant={'error'} id={`${fieldId}-helper-error`} >If PF doesn’t forward aria-live on HelperTextItem, skip this suggestion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
libs/ui-lib/lib/common/components/ui/formik/TextAreaField.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: format
- GitHub Check: tests
- GitHub Check: circular-deps
- GitHub Check: unit-tests
- GitHub Check: translation-files
- GitHub Check: lint
🔇 Additional comments (1)
libs/ui-lib/lib/common/components/ui/formik/TextAreaField.tsx (1)
63-76: Nice refactor: error and helper text can now co-exist.This directly supports the “keep link to pull secret visible” requirement by rendering the helper text even when an error is present. Clean, readable, and aligns with PF HelperText patterns.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: celdrake, ElayAharoni The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
celdrake
left a comment
There was a problem hiding this comment.
Actually, the "aria-describedby" may need changes as described by Coderabbit.
b93e663
into
openshift-assisted:master
|
/cherry-pick releases/v2.15-cim |
|
@jgyselov: new pull request created: #3153 DetailsIn response to this:
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-sigs/prow repository. |

https://issues.redhat.com/browse/MGMT-21261
Summary by CodeRabbit
Bug Fixes
Refactor