Skip to content

[BUGFIX] Allow to clear unit selector input when typing - #233

Open
adrianSepiol wants to merge 2 commits into
perses:mainfrom
adrianSepiol:bugfix/allow-to-clear-unit-selector
Open

[BUGFIX] Allow to clear unit selector input when typing#233
adrianSepiol wants to merge 2 commits into
perses:mainfrom
adrianSepiol:bugfix/allow-to-clear-unit-selector

Conversation

@adrianSepiol

Copy link
Copy Markdown
Contributor

Fixes: perses/perses#4281

Description

Problem
The UnitSelector component used MUI Autocomplete's built-in clear button, which fires onChange with null when the user deletes all text from the input field. This caused the fallback logic to silently reset the unit to Decimal — even when the user was mid-edit and hadn't confirmed a new selection.

Fix

  • Set disableClearable on the SettingsAutocomplete to prevent MUI from firing onChange(null) on text deletion.
  • Introduced an explicit IconButton with a ClearIcon as a controlled clear action. This button only resets the value to undefined (Decimal) when the user deliberately clicks it.

Behavior Changes
Previously: deleting all text from the input and clicking away would reset the unit to Decimal.
Now: deleting all text and clicking away leaves the current value unchanged. Only clicking the ✕ button explicitly resets the unit to Decimal.

Screenshots

Screen.Recording.2026-08-18.at.11.49.52.mov

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.
  • E2E tests are stable and unlikely to be flaky.
    See e2e docs for more details. Common issues include:
    • Is the data inconsistent? You need to mock API requests.
    • Does the time change? You need to use consistent time values or mock time utilities.
    • Does it have loading states? You need to wait for loading to complete.

@adrianSepiol
adrianSepiol requested a review from a team as a code owner August 18, 2026 10:04
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
@adrianSepiol
adrianSepiol force-pushed the bugfix/allow-to-clear-unit-selector branch from a16c48f to 54079e8 Compare August 18, 2026 10:06
…kage-lock.json

Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
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.

Unit selector does not allow to clear field completely

1 participant