Overview

Add tests to confirm an input in the semi coupled form work with autocomplete. If it turns out that doesn't currently work... this issue should provide the fix as well.

Proposed resolution

Create a test-only module that uses a form_alter to add an autocomplete input to the props form and add e2e tests to confirm it works.

User interface changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bnjmnm created an issue. See original summary.

bnjmnm’s picture

Issue summary: View changes
wim leers’s picture

Component: Page builder » Semi-Coupled theme engine
bnjmnm’s picture

Assigned: Unassigned » bnjmnm
bnjmnm’s picture

Assigned: bnjmnm » Unassigned

Added a test module in the MR and found that the autocomplete inputs (which had been proven to work in the past but never got test coverage) no longer work due to the input now using the Radix TextField component. This component intercepts a few props, including className and applies them to the input's parent <div> instead of the <input/> and Drupal's autocomplete initializes based on the presence of .form-autocomplete on an <input/> element.

bnjmnm’s picture

Between this issue and #3481719: Get Semi-coupled Checkbox form elements to work with the State API , if we want to continue using Radix we need to have a way to customize the attributes sent to the input elements within the component. I filed an issue with primitives about doing this with Checkbox, and if that is welcomed I'll do the same in Radix themes for the TextField component

effulgentsia’s picture

effulgentsia’s picture

Issue tags: +blocker
effulgentsia’s picture

If Radix doesn't accept the PR, is there a way we can accomplish it (without forking Radix) via ref? Does Radix already forward refs to the form element we'd want our attributes on?

bnjmnm’s picture

StatusFileSize
new40.86 KB

It can be done with a ref!

Updated MR on the way...

bnjmnm’s picture

Status: Active » Needs review
effulgentsia’s picture

I think the MR looks great. Should we upgrade to React 19 and take advantage of the nicer syntax for refs?

wim leers’s picture

Assigned: Unassigned » bnjmnm
Status: Needs review » Needs work

#13: Let's not expand the scope here. 🙏 Opened #3510610: [PP-1] After upgrading to React 19, refactor forwardRefs to ref props for that ☺️

Some discoverability and consistency remarks, plus I don't understand why test is being changed. I bet it's all trivial for @bnjmnm to address 👍

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Status: Needs work » Needs review

Feedback addressed and the Cypress memory issue was seemingly addressed by making the test module name shorter (???)

wim leers’s picture

Assigned: Unassigned » balintbrews

#15: WTF?!?! 🤪

Self-addressed remaining nits. Now needs FE review.

bnjmnm’s picture

Assigned: balintbrews » hooroomoo

@balintbrews approved this but it looks like we still need a semi-coupled owner to approve too> @hooroomoo seems like the best candidate for that

bnjmnm’s picture

Assigned: hooroomoo » Unassigned
StatusFileSize
new639.23 KB

After a few days of e2e tests passing reliably, the autocomplete test introduced here began encountering the unpredictable+ambiguous "We detected that the Electron Renderer process just crashed.". So we can continue working without false-red-x's popping up, the autocomplete e2e test is bypassed on headless and the screenshot below shows that it is passing fine on headed.

  • bnjmnm committed f3f5dcb4 on 0.x
    Issue #3481717 by bnjmnm, wim leers: Confirm Semi-coupled form elements...

bnjmnm credited hooroomoo.

bnjmnm’s picture

Status: Needs review » Fixed

Merged. Thanks for the reviews everybody!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.