Skip to content

Conversation

@skanakal
Copy link
Contributor

@skanakal skanakal commented Jan 6, 2026

Summary

Fixes #16317

Occurred changes and/or fixed issues

validate the input at the CodeMirror component

Technical notes summary

The CodeMirror.vue component’s onInput() handler forwarded editor output directly..
Whitespace-only values were not detected.

Areas or cases that should be tested

Areas which could experience regressions

Screenshot/Video

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

what do the codemirror docs say, anything in their repo issues about this? if a bug is it in their implementation or our integration?

},
onInput(newCode) {
if (typeof newCode === 'string' && newCode.trim() === '') {
Copy link
Member

Choose a reason for hiding this comment

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

how do we know that users will never need a whitespace value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially, I assumed Kubernetes treated whitespaces values as empty and added trimming logic based on that assumption but that wasn't for configmap...
It doesn't look like a bug to me, deleting the last character often leaves a "ghost space" in the editor buffer...our CSS renders a "dot" for every space, that ghost space creates a visual bug...

  • doc.getValue() to get the content and doc.setValue(content: string) to set it to empty which strips the .cm-markdown-single-trailing-space class from the DOM, which causes the "dot" to disappear...

Copy link
Member

Choose a reason for hiding this comment

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

The question revolved around this being a generic component to display text where a blank space might be expected or required. So i think we can move away from kube specific requirements.

Something is adding that white space when it shouldn't do, feels like the solution should be to address that part rather than working around it.

@richard-cox richard-cox added this to the v2.15.0 milestone Jan 6, 2026
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.

When creating a configmap in GUI a space is added to a empty value

2 participants