Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 6, 2025

This PR implements autocomplete attribute support for the <x-input> custom element by forwarding the attribute value to the internal HTML input element in the shadow DOM.

Changes Made

Core Implementation

  • XInputAttribute.ts: Added autocomplete to the observedAttributes array and implemented an attribute handler using the bindToAttribute helper
  • The implementation follows the established pattern used for other attributes like disabled

Testing

  • attribute-autocomplete.html: Created test HTML file with autocomplete="username" attribute set on x-input
  • web-elements.spec.ts: Added Playwright test case to verify the autocomplete attribute is properly forwarded to the shadow DOM input element

Technical Details

The implementation uses the existing bindToAttribute helper function to automatically forward the autocomplete attribute value from the custom element to the internal #input element. No value transformation is needed - the attribute value passes through as-is.

@registerAttributeHandler('autocomplete', true)
#handleAutocomplete = bindToAttribute(
  this.#getInputElement,
  'autocomplete',
);

Usage

Users can now use standard HTML autocomplete attributes on x-input elements:

<x-input autocomplete="username"></x-input>
<x-input autocomplete="email"></x-input>
<x-input autocomplete="current-password"></x-input>
<x-input autocomplete="off"></x-input>

The autocomplete attribute will be properly forwarded to the underlying HTML input element, enabling browser autocomplete functionality as expected.

Fixes #1440.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@changeset-bot
Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: 255f451

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@lynx-js/web-elements Patch
@lynx-js/web-elements-template Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI changed the title [WIP] Pass autocomplete attribute value to the internal <input> element for <x-input> Add autocomplete attribute support for x-input component Aug 6, 2025
Copilot AI requested a review from PupilTong August 6, 2025 04:16
Copilot finished work on behalf of PupilTong August 6, 2025 04:16
@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 6, 2025

CodSpeed Performance Report

Merging #1444 will not alter performance

Comparing copilot/fix-1440 (6de10ed) with main (a3f1e3e)

Summary

✅ 10 untouched benchmarks

@PupilTong
Copy link
Collaborator

@copilot-swe-agent create a patch changeset with 'feat:' prefix

Copy link
Contributor Author

Copilot AI commented Aug 6, 2025

@copilot-swe-agent create a patch changeset with 'feat:' prefix

Created patch changeset with 'feat:' prefix for the autocomplete attribute support feature. Commit: a6b09bb

Copilot finished work on behalf of PupilTong August 6, 2025 11:43
@PupilTong
Copy link
Collaborator

@copilot The html file is incorrect, regenerate it by using reference of packages/web-platform/web-tests/tests/web-elements/x-input/placeholder.html

Copy link
Contributor Author

Copilot AI commented Aug 7, 2025

@copilot The html file is incorrect, regenerate it by using reference of packages/web-platform/web-tests/tests/web-elements/x-input/placeholder.html

Regenerated the HTML file using the structure from placeholder.html as reference. The file now includes the proper copyright header, comprehensive meta tags, correct CSS and script links, and uses the x-view wrapper pattern consistent with other test files. Commit: c9836f0

Copilot finished work on behalf of PupilTong August 7, 2025 07:46
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@PupilTong PupilTong marked this pull request as ready for review August 7, 2025 13:10
@relativeci
Copy link

relativeci bot commented Aug 7, 2025

Web Explorer

#3911 Bundle Size — 343.8KiB (+0.08%).

6de10ed(current) vs a3f1e3e main#3899(baseline)

Bundle metrics  Change 4 changes Regression 1 regression
                 Current
#3911
     Baseline
#3899
Regression  Initial JS 143.27KiB(+0.19%) 143KiB
No change  Initial CSS 31.84KiB 31.84KiB
Change  Cache Invalidation 41.63% 0%
No change  Chunks 7 7
No change  Assets 7 7
Change  Modules 212(+0.47%) 211
No change  Duplicate Modules 17 17
Change  Duplicate Code 3.96%(-0.25%) 3.97%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#3911
     Baseline
#3899
Regression  JS 229.01KiB (+0.12%) 228.74KiB
No change  Other 82.95KiB 82.95KiB
No change  CSS 31.84KiB 31.84KiB

Bundle analysis reportBranch copilot/fix-1440Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Aug 7, 2025

React Example

#3915 Bundle Size — 235.26KiB (0%).

6de10ed(current) vs a3f1e3e main#3903(baseline)

Bundle metrics  no changes
                 Current
#3915
     Baseline
#3903
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 159 159
No change  Duplicate Modules 64 64
No change  Duplicate Code 45.81% 45.81%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#3915
     Baseline
#3903
No change  IMG 145.76KiB 145.76KiB
No change  Other 89.5KiB 89.5KiB

Bundle analysis reportBranch copilot/fix-1440Project dashboard


Generated by RelativeCIDocumentationReport issue

@PupilTong PupilTong requested a review from hzy August 8, 2025 08:06
@PupilTong PupilTong requested review from colinaaa and Copilot August 8, 2025 08:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds autocomplete attribute support to the x-input component by forwarding the attribute value to the internal HTML input element in the shadow DOM, enabling standard browser autocomplete functionality.

  • Added autocomplete to the observedAttributes array in XInputAttribute.ts
  • Implemented attribute handler using the bindToAttribute helper following established patterns
  • Added comprehensive test coverage to verify the attribute forwarding functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
XInputAttribute.ts Added autocomplete attribute support with proper handler implementation
attribute-autocomplete.html Created test HTML file with x-input element using autocomplete="username"
web-elements.spec.ts Added Playwright test to verify autocomplete attribute forwarding to shadow DOM
neat-frogs-autocomplete.md Added changeset documenting the new feature

@PupilTong PupilTong self-requested a review August 8, 2025 08:12
@PupilTong PupilTong merged commit ea325d6 into main Aug 8, 2025
91 of 97 checks passed
@PupilTong PupilTong deleted the copilot/fix-1440 branch August 8, 2025 08:12
upupming pushed a commit to upupming/lynx-stack that referenced this pull request Aug 8, 2025
…#1444)

This PR implements autocomplete attribute support for the `<x-input>`
custom element by forwarding the attribute value to the internal HTML
input element in the shadow DOM.

## Changes Made

### Core Implementation
- **XInputAttribute.ts**: Added `autocomplete` to the
`observedAttributes` array and implemented an attribute handler using
the `bindToAttribute` helper
- The implementation follows the established pattern used for other
attributes like `disabled`

### Testing
- **attribute-autocomplete.html**: Created test HTML file with
`autocomplete="username"` attribute set on x-input
- **web-elements.spec.ts**: Added Playwright test case to verify the
autocomplete attribute is properly forwarded to the shadow DOM input
element

## Technical Details

The implementation uses the existing `bindToAttribute` helper function
to automatically forward the autocomplete attribute value from the
custom element to the internal `#input` element. No value transformation
is needed - the attribute value passes through as-is.

```typescript
@registerAttributeHandler('autocomplete', true)
#handleAutocomplete = bindToAttribute(
  this.#getInputElement,
  'autocomplete',
);
```

## Usage

Users can now use standard HTML autocomplete attributes on x-input
elements:

```html
<x-input autocomplete="username"></x-input>
<x-input autocomplete="email"></x-input>
<x-input autocomplete="current-password"></x-input>
<x-input autocomplete="off"></x-input>
```

The autocomplete attribute will be properly forwarded to the underlying
HTML input element, enabling browser autocomplete functionality as
expected.

Fixes lynx-family#1440.

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `esm.ubuntu.com`
>   - Triggering command: `/usr/lib/apt/methods/https` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/lynx-family/lynx-stack/settings/copilot/coding_agent)
(admins only)
>
> </details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to
start the survey.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: PupilTong <[email protected]>
colinaaa pushed a commit that referenced this pull request Aug 9, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/[email protected]

### Patch Changes

- Supports `recyclable` attribute in `<list-item>` to control whether
the list item is recyclable. The `recyclable` attribute depends on Lynx
Engine 3.4 or later.
([#1388](#1388))

    ```jsx
    <list-item recyclable={false} />
    ```

- feat: Support using a host element as direct child of Suspense
([#1455](#1455))

- Add profile in production build:
([#1336](#1336))

    1.  `diff:__COMPONENT_NAME__`: how long ReactLynx diff took.
    2.  `render:__COMPONENT_NAME__`: how long your render function took.
3. `setState`: an instant trace event, indicate when your setState was
called.

NOTE: `__COMPONENT_NAME__` may be unreadable when minified, setting
`displayName` may help.

- Add `onBackgroundSnapshotInstanceUpdateId` event on dev for Preact
Devtools to keep the correct snapshotInstanceId info.
([#1173](#1173))

- fix: Prevent error when spreading component props onto an element
([#1459](#1459))

- fix: Correctly check for the existence of background functions in MTS
([#1416](#1416))

    ```ts
    function handleTap() {
      "main thread";
      // The following check always returned false before this fix
      if (myHandleTap) {
        runOnBackground(myHandleTap)();
      }
    }
    ```

## @lynx-js/[email protected]

### Patch Changes

- Remove the experimental `provider` option.
([#1432](#1432))

- Add `output.filename.wasm` and `output.filename.assets` options.
([#1449](#1449))

- fix deno compatibility
([#1412](#1412))

- Should call the `api.onCloseBuild` hook after the build finished.
([#1446](#1446))

- Bump Rsbuild v1.4.15.
([#1423](#1423))

- Support using function in `output.filename.*`.
([#1449](#1449))

## [email protected]

### Patch Changes

- Support ESLint for ReactLynx templates
([#1274](#1274))

## @lynx-js/[email protected]

### Patch Changes

- Updated dependencies
\[[`c8ce6aa`](c8ce6aa)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Fix the `Package subpath './compat' is not defined by "exports"`
error. ([#1460](#1460))

## @lynx-js/[email protected]

### Patch Changes

- Fix `GlobalEventEmitter` type definition, the `emit(eventName: string,
data: unknown)` function should recevie an array typed `data` and pass
as param list of listeners.
([#1479](#1479))

## @lynx-js/[email protected]

### Patch Changes

- fix: load main-thread chunk in ESM format
([#1437](#1437))

See [nodejs/node#59362](nodejs/node#59362) for
more details.

- feat: support path() for `createQuerySelector`
([#1456](#1456))

- Added `getPathInfo` API to `NativeApp` and its cross-thread handler
for retrieving the path from a DOM node to the root.
- Implemented endpoint and handler registration in both background and
UI threads.
    -   Implemented `nativeApp.getPathInfo()`

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix: load main-thread chunk in ESM format
([#1437](#1437))

See [nodejs/node#59362](nodejs/node#59362) for
more details.

- feat: support path() for `createQuerySelector`
([#1456](#1456))

- Added `getPathInfo` API to `NativeApp` and its cross-thread handler
for retrieving the path from a DOM node to the root.
- Implemented endpoint and handler registration in both background and
UI threads.
    -   Implemented `nativeApp.getPathInfo()`

- fix: when `onNativeModulesCall` is delayed in mounting, the
NativeModules execution result may be undefined.
([#1457](#1457))

- fix: `onNativeModulesCall` && `onNapiModulesCall` use getter to get.
([#1466](#1466))

- Updated dependencies
\[[`29434ae`](29434ae),
[`fb7096b`](fb7096b)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix: load main-thread chunk in ESM format
([#1437](#1437))

See [nodejs/node#59362](nodejs/node#59362) for
more details.

## @lynx-js/[email protected]

### Patch Changes

- feat: add autocomplete attribute support for x-input component
([#1444](#1444))

Implements autocomplete attribute forwarding from the x-input custom
element to the internal HTML input element in the shadow DOM. This
enables standard browser autocomplete functionality for x-input
elements.

- Add referrerpolicy attribute support to x-image web component
([#1420](#1420))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix: load main-thread chunk in ESM format
([#1437](#1437))

See [nodejs/node#59362](nodejs/node#59362) for
more details.

- Updated dependencies
\[[`29434ae`](29434ae),
[`fb7096b`](fb7096b)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support path() for `createQuerySelector`
([#1456](#1456))

- Added `getPathInfo` API to `NativeApp` and its cross-thread handler
for retrieving the path from a DOM node to the root.
- Implemented endpoint and handler registration in both background and
UI threads.
    -   Implemented `nativeApp.getPathInfo()`

- Updated dependencies
\[[`29434ae`](29434ae),
[`fb7096b`](fb7096b)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## [email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.

Pass autocomplete attribute value to the internal <input> element for <x-input>

5 participants