Skip to content

fix(ui): keep creatable tag fields from opening an empty Autocomplete - #35419

Closed
shrabantipaul-collate wants to merge 10 commits into
mainfrom
shrabantipaul-collate/openmetadata-flaky-run-fix
Closed

shrabantipaul-collate wants to merge 10 commits into
mainfrom
shrabantipaul-collate/openmetadata-flaky-run-fix

Conversation

@shrabantipaul-collate

@shrabantipaul-collate shrabantipaul-collate commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes the flaky Data Contracts › Add and update Security and SLA tabs test (DataContracts.spec.ts:1919), which failed in merge-queue run 38518715793.

Issue: The Identities tag field could stay "open" after the test typed, pressed Enter and moved on. While a combobox is open, react-aria marks the rest of the page aria-hidden, including the new row filter added afterwards. Playwright's getByRole('combobox') couldn't find that row and timed out.

Cause: A creatable tag field (hideDropdown) has no list, but the core Autocomplete still opened it on focus and on every keystroke. So whenever a tag field had focus, the rest of the page was hidden from screen readers and from role queries, and the field reported aria-expanded="true". On top of that, react-stately reopens the menu a moment after the text changes. A fast type → Enter → move-on can blur the field before that reopen lands, leaving it stuck open.

Where it started: #35217 moved the Data Contract security form from antd Select mode="tags" to core Autocomplete tag fields (allowsCreation + hideDropdown). The other tag fields (glossary term form and synonyms editor, task form builder options, and the SSO and workflow array fields when they have no options) have the same bug. Their tests didn't catch it because they look elements up with getByTestId, which still matches hidden elements.

Fix (at the call sites — the core Autocomplete is unchanged):
Every creatable tag field spreads a shared TAG_INPUT_COMBOBOX_PROPS (constants/Form.constants.ts):

export const TAG_INPUT_COMBOBOX_PROPS = {
  allowsEmptyCollection: false,
  menuTrigger: 'manual',
} as const;

Core already forwards these to the react-aria ComboBox. With them, focus and typing never open a tag field. That includes the late reopen after blur that caused the flake. react-stately also closes an empty list that a click or ArrowDown opened, so a tag field can no longer stay open. A click or ArrowDown still opens it for one render before that close; removing that last flash would need a core change.

Applied to: Data Contract security form (tagField), glossary term form and synonyms editor, task form builder options, and the SSO and workflow array templates when they have no options.

The test helper keeps its role-based lookups, so it checks what assistive tech sees.

Type of change:

  • Bug fix

Tests:

  • Unit (ContractSecurityFormTab.test.tsx, new test): click into Identities, type a value, press Enter, then ArrowDown. A chip is added, the field stays collapsed, the rest of the form is still reachable by role (role queries skip aria-hidden nodes), and the form isn't submitted. It fails on main (aria-expanded="true") and without the call-site props.

  • App unit tests for every touched area pass: 117 suites, 1444 tests (Data Contract, Glossary, SSO, common forms, task form settings, TestDefinitionForm, Assignees, custom properties).

  • Playwright, run locally against this branch with retries off, each test ×10 (3 workers): all 30 runs passed, plus setup and teardown, in 4.4 min.

    • DataContracts.spec.ts:1919, Security and SLA tabs: 10/10.
    • DataContractInheritance.spec.ts:637, Add SLA when inheriting: 10/10.
    • GlossaryTermDetails.spec.ts:45, add and remove synonyms: 10/10.

    Playwright output for that run (commit e6e2580d354):

    image

UI screen recording:

Not applicable — bug fix with no visual change.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable defects were found.

Summary

Keeps creatable tag fields from opening an empty Autocomplete on focus or typing.

  • Creatable tag fields stay closed when they have no suggestions.

No actionable issues were found.

Reviews (2) · Last reviewed commit: "Merge branch 'main' into shrabantipaul-c..." · Reviewed by Greptile

react-stately reopens the ComboBox menu from a passive effect when the
input value changes, and that update renders in a later task. Typing,
pressing Enter and moving to the next field quickly can blur the input
first, so the open lands on an unfocused combobox that no later blur
closes. While open, react-aria's useComboBox runs ariaHideOutside — even
for hideDropdown tag fields with no popover — so the rest of the page and
every node added afterwards is aria-hidden.

That made "Data Contracts > Add and update Security and SLA tabs" flaky:
the Identities tag field stayed open, the newly added row filter was
aria-hidden, and getByRole('combobox') never resolved.

Close the combobox whenever it is open without focus, and only reopen on
mousedown when the input is already focused (an unfocused input opens on
the focus the press causes).
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added the UI UI specific issues label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@shrabantipaul-collate shrabantipaul-collate added the safe to test Add this label to run secure Github workflows on PRs label Oct 14, 2026
…t role

A creatable tag field left open after a fast type-Enter-move aria-hides the
rest of the page, and role queries skip aria-hidden nodes, so the column
picker in the Security tab could never be found. Locate the input, option
and chip button by test id and attributes instead.
A creatable tag field (hideDropdown) has no list, but it still opened on
focus and on every keystroke. While open, react-aria reports
aria-expanded="true" and aria-hides the rest of the page, including nodes
added later, so screen readers and role queries lost the form whenever the
field was focused — and a fast type-Enter-move could leave it stuck open.

- hideDropdown fields use menuTrigger="manual" and our own ArrowDown and
  mousedown handlers no longer open them; Enter in them never submits the
  surrounding form.
- The open guard now also closes a field without a dropdown that
  react-aria's own arrow-key or touch handlers opened.

With the root cause fixed in the component, the Data Contract test helper
goes back to role-based lookups, which check what assistive tech sees.
@shrabantipaul-collate shrabantipaul-collate changed the title fix(ui-core): close an Autocomplete left open after its input blurs fix(ui-core): never leave an Autocomplete open without a dropdown or focus Oct 14, 2026
…e closes

The Autocomplete fix keeps a combobox open only while its input is
focused. TestDefinitionFormBody and Assignees opened it with synthetic
mouseDown/focus events that never move focus in jsdom, so their option
lists never rendered; click the input with userEvent instead.

The race tests asserted the collapsed state at a fixed 50ms settle, but
the passive effect that closes a late open can land after it on a loaded
runner; wait for the collapse instead.
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 78%
78.1% (128206/164152) 64.75% (81215/125423) 66.05% (27146/41095)

shrabantipaul-collate and others added 4 commits October 15, 2026 10:40
The previous fix kept tag fields (hideDropdown) closed with
menuTrigger="manual" plus hideDropdown checks in our ArrowDown, mousedown
and close-effect handlers. react-aria's own arrow-key and touch handlers
still opened the field for one render before the effect closed it, which
flashed aria-expanded and aria-hid the page.

A tag field now passes no items and disallows an empty collection, so
react-stately refuses every open at the source. Main's menuTrigger="focus"
and ArrowDown handler come back unchanged, and the close effect reduces to
one rule: close when the input is not focused.
…ta-flaky-run-fix' into shrabantipaul-collate/openmetadata-flaky-run-fix
Review asked to leave the core Autocomplete untouched, so this reverts
every core change on the branch and fixes the bug where the fields are
used.

A creatable tag field (hideDropdown) has no list, but core opens it on
focus and on every keystroke. While open, react-aria aria-hides the rest
of the page, and a fast type → Enter → move-on could leave it stuck open
after blur, so role queries (and screen readers) lost the form.

Each tag field now spreads TAG_INPUT_COMBOBOX_PROPS
(menuTrigger: 'manual', allowsEmptyCollection: false), which core
already forwards to the react-aria ComboBox: focus and typing never open
it, and react-stately closes an empty list that a click or arrow key
opened. Applied to the Data Contract security form, glossary term form
and synonyms editor, task form builder options, and the SSO and workflow
array templates when they have no options.

The jest updates to TestDefinitionFormBody and Assignees only existed
for the reverted core close-on-blur effect and go back to main too.
@shrabantipaul-collate shrabantipaul-collate changed the title fix(ui-core): never leave an Autocomplete open without a dropdown or focus fix(ui): keep creatable tag fields from opening an empty Autocomplete Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 10 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 10 warning(s) across 5 changed file(s).

Count Rule
9 react-hooks/exhaustive-deps
1 openmetadata-imports/no-cross-page-imports
All findings
Location Rule Message
🟡 src/components/DataContract/ContractSecurityFormTab/ContractSecurityFormTab.tsx:367:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'columnItems' and 'form'. Either include them or remove the dependency array.
🟡 src/components/Glossary/GlossaryTerms/tabs/GlossaryTermSynonyms.tsx:165:9 react-hooks/exhaustive-deps The 'getSynonyms' function makes the dependencies of useCallback Hook (at line 268) change on every render. Move it inside the useCallback callback. Alternative
🟡 src/components/SettingsSso/SSOConfigurationForm/SsoConfigurationFormArrayFieldTemplate.tsx:149:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes
🟡 src/components/SettingsSso/SSOConfigurationForm/SsoConfigurationFormArrayFieldTemplate.tsx:179:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes
🟡 src/components/SettingsSso/SSOConfigurationForm/SsoConfigurationFormArrayFieldTemplate.tsx:198:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes
🟡 src/components/SettingsSso/SSOConfigurationForm/SsoConfigurationFormArrayFieldTemplate.tsx:204:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes
🟡 src/components/common/Form/JSONSchema/JSONSchemaTemplate/WorkflowArrayFieldTemplate.tsx:75:5 react-hooks/exhaustive-deps React Hook useCallback has an unnecessary dependency: 'value'. Either exclude it or remove the dependency array.
🟡 src/components/common/Form/JSONSchema/JSONSchemaTemplate/WorkflowArrayFieldTemplate.tsx:102:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes
🟡 src/components/common/Form/JSONSchema/JSONSchemaTemplate/WorkflowArrayFieldTemplate.tsx:115:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when any prop changes
🟡 src/pages/TaskFormSettingsPage/components/TaskFormBuilderSection.tsx:50:1 openmetadata-imports/no-cross-page-imports Page features must not import another page feature. Move shared code to components, hooks, interfaces, or pure utilities.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@gitar-bot

gitar-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Applying manual, no-empty-list behavior to tag Autocomplete fields across several forms could disrupt expected keyboard interactions.

Adds TAG_INPUT_COMBOBOX_PROPS (allowsEmptyCollection: false, menuTrigger: 'manual') to every creatable tag field so focus and typing no longer open an empty Autocomplete, which was hiding the rest of the page from role queries and causing the flaky Security and SLA tab test. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

auto-merge was automatically disabled October 23, 2026 12:54

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant