Repository navigation
Fixes #6884: migrate selection and numeric forms to core #35262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shah-harshit
merged 7 commits into
shah-harshit/7300-antd-display-components
from
shah-harshit/7302-core-controls-and-forms
Oct 13, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
da07044
refactor(ui): migrate selection and numeric fields to core
shah-harshit 74b68c6
fix(ui): preserve tree picker keyboard navigation and labels
shah-harshit 908a0ed
fix(ui): name learning resource rows for accessible tables
shah-harshit f1e6a4f
fix(ui): keep KPI sliders visible beside numeric targets
shah-harshit 31366a1
fix(ui): retain async permission search results in combobox
shah-harshit dc5e156
test(ui): assert core ButtonGroup, NumberInput and Slider behaviour i…
shah-harshit c07af2f
test(ui): upload CSVs through the core file input in EntityImport tests
shah-harshit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
docs/decisions/2026-10-12-numeric-fields-preserve-edits-and-api-values.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Numeric fields preserve decimal edits and nullable API values | ||
|
|
||
| - **Status:** Accepted | ||
| - **Revisions:** v1 2026-10-12 (initial) | ||
| - **Deciders:** Harshit Shah | ||
| - **Guard:** core `number-input.test.tsx`, `ProfilerSettingsModal.test.tsx`, `ContractSLAFormTab.utils.test.ts` | ||
| - **Related:** open-metadata/openmetadata-collate#7302, open-metadata/openmetadata-collate#7303 | ||
|
|
||
| ## Context | ||
| Migrating numeric fields must retain decimal editing, clearing, bounds, and numeric payloads. | ||
| A grid-based stepper changes 3.5 to 5 with a step of 1; existing fields increment it to 4.5. | ||
| Browser step/min validation can also reject stored profiler samples of zero when saving an | ||
| otherwise untouched configuration. Clearing a field must remain distinguishable from zero. | ||
|
|
||
| ## Decision | ||
| Core `NumberInput` maintains an editable string and reports finite numbers or `null`. Bounds | ||
| apply when editing is committed; loading a controlled value does not silently rewrite it. | ||
| Arrow keys add the requested step relative to the edited value rather than snapping to a grid. | ||
| Native spinner buttons are hidden because they use grid stepping. Decimal arithmetic avoids | ||
| binary rounding drift; explicit precision is limited to 0–20 fractional digits. | ||
|
|
||
| Forms bind numeric callbacks directly to React Hook Form. Serializers distinguish `null` from | ||
| zero and omit cleared optional durations. Wall-clock SLA availability remains an HH:mm string; | ||
| selecting a timezone does not convert that clock time. | ||
|
|
||
| ## Consequences | ||
| Core owns numeric behavior and styling. Callers keep domain validation and serialization, | ||
| including compatibility with existing stored values. These contracts are covered by interaction | ||
| and payload tests rather than assertions about Ant Design markup. |
96 changes: 96 additions & 0 deletions
96
...c/main/resources/ui/src/components/application/tree-select/tree-select-migration.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* | ||
| * Copyright 2025 Collate. | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| import { render, screen, waitFor } from '@testing-library/react'; | ||
| import userEvent from '@testing-library/user-event'; | ||
| import { describe, expect, it, vi } from 'vitest'; | ||
| import { TreeSelect } from './tree-select'; | ||
| import { TreeSelectNode } from './tree-select.types'; | ||
|
|
||
| const children: TreeSelectNode[] = [ | ||
| { id: 'a', label: 'A', value: 'a' }, | ||
| { id: 'b', label: 'B', value: 'b' }, | ||
| ]; | ||
| const parent: TreeSelectNode = { | ||
| id: 'all', | ||
| label: 'All', | ||
| value: 'all', | ||
| children, | ||
| }; | ||
| const fetchData = async () => ({ nodes: [parent] }); | ||
|
|
||
| describe('TreeSelect migrated selection contracts', () => { | ||
| it('moves keyboard focus into asynchronously loaded options and selects with Enter', async () => { | ||
| const onChange = vi.fn(); | ||
| const user = userEvent.setup(); | ||
| render( | ||
| <TreeSelect | ||
| multiple | ||
| searchable | ||
| aria-label="Choose teams" | ||
| fetchData={async () => ({ nodes: children })} | ||
| id="teams" | ||
| onChange={onChange} | ||
| /> | ||
| ); | ||
| const input = screen.getByRole('combobox', { name: 'Choose teams' }); | ||
| expect(input).toHaveAttribute('id', 'teams'); | ||
| await user.click(input); | ||
| await user.keyboard('{ArrowDown}'); | ||
| const firstRow = await screen.findByRole('row', { name: 'A' }); | ||
| await waitFor(() => expect(firstRow).toHaveFocus()); | ||
| expect(input).toHaveAttribute( | ||
| 'aria-controls', | ||
| screen.getByRole('treegrid').id | ||
| ); | ||
| await user.keyboard('{Enter}'); | ||
| await waitFor(() => expect(onChange).toHaveBeenCalledWith([children[0]])); | ||
| }); | ||
|
|
||
| it('limits visible chips without discarding hidden selections', () => { | ||
| render( | ||
| <TreeSelect | ||
| multiple | ||
| fetchData={fetchData} | ||
| maxVisibleItems={1} | ||
| placeholder="Teams" | ||
| value={children} | ||
| /> | ||
| ); | ||
| expect(screen.getByText('A')).toBeInTheDocument(); | ||
| expect(screen.queryByText('B')).not.toBeInTheDocument(); | ||
| expect(screen.getByText('+1')).toBeInTheDocument(); | ||
| }); | ||
| it('collapses a selected branch in the trigger and forwards focus events', async () => { | ||
| const onFocus = vi.fn(); | ||
| const onBlur = vi.fn(); | ||
| const user = userEvent.setup(); | ||
| render( | ||
| <TreeSelect | ||
| cascadeSelection | ||
| multiple | ||
| fetchData={fetchData} | ||
| placeholder="Metrics" | ||
| selectedDisplayStrategy="parent" | ||
| value={[parent, ...children]} | ||
| onBlur={onBlur} | ||
| onFocus={onFocus} | ||
| /> | ||
| ); | ||
| expect(screen.getByText('All')).toBeInTheDocument(); | ||
| expect(screen.queryByText('A')).not.toBeInTheDocument(); | ||
| await user.click(screen.getByRole('combobox', { name: 'Metrics' })); | ||
| expect(onFocus).toHaveBeenCalled(); | ||
| await user.tab(); | ||
| expect(onBlur).toHaveBeenCalled(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Bug: Pending tree focus outlives empty results and steals focus while typing
If ArrowDown is pressed while the dropdown shows the no-data branch (lines 1035-1038 render no
role="row"), the effect finds no row, sopendingTreeFocusstays set. Because the effect depends onfilteredTreeData, the user can then type a search term in the searchable input, and as soon as results appearrow.focus()moves focus off the input in the middle of typing. The same thing happens when ArrowDown is pressed and the user keeps typing while a search fetch is loading. Fix: clear the pending focus once loading has finished without finding a row, and also clear it whenever the input value changes.Drop the pending request when no row exists after loading, and on any search edit:
Was this helpful? React with 👍 / 👎