Skip to content

Conversation

@rzzf
Copy link
Contributor

@rzzf rzzf commented Dec 22, 2025

The code is sourced from DefinitelyTyped

Summary by CodeRabbit

  • New Features
    • Improved TypeScript support for input autocomplete attributes, offering richer, more specific autocomplete options and stronger typing for billing, shipping, contact, and credential-related form fields — enhancing IDE suggestions and reducing form-related type errors.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 22, 2025

Walkthrough

Adds multiple TypeScript type aliases describing HTML autocomplete/autofill tokens in packages/runtime-dom/src/jsx.ts and changes InputHTMLAttributes.autocomplete from string | undefined to InputAutoCompleteAttribute | undefined.

Changes

Cohort / File(s) Change Summary
Autofill typings
packages/runtime-dom/src/jsx.ts
Added many new type aliases for autocomplete/autofill semantics (AutoFillAddressKind, AutoFillBase, AutoFillContactField, AutoFillContactKind, AutoFillCredentialField, AutoFillNormalField, OptionalPrefixToken, OptionalPostfixToken, AutoFillField, AutoFillSection, AutoFill, InputAutoCompleteAttribute) and updated InputHTMLAttributes.autocomplete from string | undefined to InputAutoCompleteAttribute | undefined

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving the type definition for the autocomplete attribute in JSX, which aligns with adding comprehensive type aliases and updating the InputHTMLAttributes.autocomplete type.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 103 kB 39.1 kB 35.2 kB
vue.global.prod.js 161 kB 59.1 kB 52.6 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 47 kB 18.4 kB 16.8 kB
createApp 55.2 kB 21.4 kB 19.6 kB
createSSRApp 59.4 kB 23.2 kB 21.1 kB
defineCustomElement 60.7 kB 23.1 kB 21.1 kB
overall 69.5 kB 26.7 kB 24.3 kB

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 22, 2025

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14237
npm i https://pkg.pr.new/@vue/compiler-core@14237
yarn add https://pkg.pr.new/@vue/compiler-core@14237.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14237
npm i https://pkg.pr.new/@vue/compiler-dom@14237
yarn add https://pkg.pr.new/@vue/compiler-dom@14237.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14237
npm i https://pkg.pr.new/@vue/compiler-sfc@14237
yarn add https://pkg.pr.new/@vue/compiler-sfc@14237.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14237
npm i https://pkg.pr.new/@vue/compiler-ssr@14237
yarn add https://pkg.pr.new/@vue/compiler-ssr@14237.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14237
npm i https://pkg.pr.new/@vue/reactivity@14237
yarn add https://pkg.pr.new/@vue/reactivity@14237.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14237
npm i https://pkg.pr.new/@vue/runtime-core@14237
yarn add https://pkg.pr.new/@vue/runtime-core@14237.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14237
npm i https://pkg.pr.new/@vue/runtime-dom@14237
yarn add https://pkg.pr.new/@vue/runtime-dom@14237.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14237
npm i https://pkg.pr.new/@vue/server-renderer@14237
yarn add https://pkg.pr.new/@vue/server-renderer@14237.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14237
npm i https://pkg.pr.new/@vue/shared@14237
yarn add https://pkg.pr.new/@vue/shared@14237.tgz

vue

pnpm add https://pkg.pr.new/vue@14237
npm i https://pkg.pr.new/vue@14237
yarn add https://pkg.pr.new/vue@14237.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14237
npm i https://pkg.pr.new/@vue/compat@14237
yarn add https://pkg.pr.new/@vue/compat@14237.tgz

commit: a7c5d60

@edison1105 edison1105 added scope: types 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels Dec 23, 2025
@edison1105
Copy link
Member

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Dec 23, 2025

📝 Ran ecosystem CI: Open

suite result latest scheduled
pinia success success
vitepress success success
primevue success success
vue-i18n failure failure
test-utils success success
vuetify failure failure
nuxt success success
radix-vue success success
vueuse success success
vite-plugin-vue success success
quasar success success
vue-simple-compiler success success
vant success success
language-tools failure failure
vue-macros failure failure
router success success

@edison1105 edison1105 added the ready to merge The PR is ready to be merged. label Dec 23, 2025
Comment on lines 564 to 623
export type AutoFillAddressKind = 'billing' | 'shipping'
export type AutoFillBase = '' | 'off' | 'on'
export type AutoFillContactField =
| 'email'
| 'tel'
| 'tel-area-code'
| 'tel-country-code'
| 'tel-extension'
| 'tel-local'
| 'tel-local-prefix'
| 'tel-local-suffix'
| 'tel-national'
export type AutoFillContactKind = 'home' | 'mobile' | 'work'
export type AutoFillCredentialField = 'webauthn'
export type AutoFillNormalField =
| 'additional-name'
| 'address-level1'
| 'address-level2'
| 'address-level3'
| 'address-level4'
| 'address-line1'
| 'address-line2'
| 'address-line3'
| 'bday-day'
| 'bday-month'
| 'bday-year'
| 'cc-csc'
| 'cc-exp'
| 'cc-exp-month'
| 'cc-exp-year'
| 'cc-family-name'
| 'cc-given-name'
| 'cc-name'
| 'cc-number'
| 'cc-type'
| 'country'
| 'country-name'
| 'current-password'
| 'family-name'
| 'given-name'
| 'honorific-prefix'
| 'honorific-suffix'
| 'name'
| 'new-password'
| 'one-time-code'
| 'organization'
| 'postal-code'
| 'street-address'
| 'transaction-amount'
| 'transaction-currency'
| 'username'
export type OptionalPrefixToken<T extends string> = `${T} ` | ''
export type OptionalPostfixToken<T extends string> = ` ${T}` | ''
export type AutoFillField =
| AutoFillNormalField
| `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`
export type AutoFillSection = `section-${string}`
export type AutoFill =
| AutoFillBase
| `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<AutoFillAddressKind>}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`
Copy link
Member

@KazariEX KazariEX Dec 23, 2025

Choose a reason for hiding this comment

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

I don't think these types should be exported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, Thanks for your review!

Copy link
Member

Choose a reason for hiding this comment

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

InputAutoCompleteAttribute can be exported like the InputTypeHTMLAttribute above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I didn't notice.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/runtime-dom/src/jsx.ts (1)

626-629: LGTM!

The updated type provides better autocomplete suggestions while maintaining backward compatibility.

For consistency, consider applying InputAutoCompleteAttribute to other elements that support the autocomplete attribute in a follow-up PR:

  • FormHTMLAttributes.autocomplete (line 484)
  • SelectHTMLAttributes.autocomplete (line 799)
  • TextareaHTMLAttributes.autocomplete (line 833)

These currently use string | undefined.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51fd709 and a7c5d60.

📒 Files selected for processing (1)
  • packages/runtime-dom/src/jsx.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test / e2e-test
🔇 Additional comments (1)
packages/runtime-dom/src/jsx.ts (1)

564-624: Well-structured autocomplete type definitions following established patterns.

The type definitions correctly model the HTML autofill field names with composable template literal types. The approach mirrors the existing InputTypeHTMLAttribute pattern on lines 539-562, and the (string & {}) escape hatch ensures backward compatibility while providing autocomplete for known values.

Only exporting InputAutoCompleteAttribute while keeping intermediate types internal is the right call, as per the previous review feedback.

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

Labels

🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready to merge The PR is ready to be merged. scope: types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants