-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
feat: add form field autofocus configuration #4550
Conversation
chore(deps): bump tailwindcss in the non-breaking-changes group (vbenjs#4369)
…rollHeight 计算准确,滚动条显示符合预期。
|
WalkthroughThe changes in this pull request enhance the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (2)
55-55
: Consider using a more generic type forfieldComponentRef
Currently,
fieldComponentRef
is typed asref<HTMLInputElement | null>(null)
. If the component being referenced is not always anHTMLInputElement
, consider using a more generic type likeHTMLElement
to accommodate different component types.Apply this diff to adjust the type:
-const fieldComponentRef = ref<HTMLInputElement | null>(null); +const fieldComponentRef = ref<HTMLElement | null>(null);
60-60
: Maintain consistent language in code commentsThe comment on line 60 is in Chinese (
// 检查当前是否有元素被聚焦
). For consistency and readability, consider translating the comment to English.Apply this diff to update the comment:
- document.activeElement !== fieldComponentRef.value // 检查当前是否有元素被聚焦 + document.activeElement !== fieldComponentRef.value // Check if the current element is focused
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (4 hunks)
🔇 Additional comments (3)
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue (3)
6-6
: Necessary imports are correctly addedThe imports of
ref
,nextTick
, andwatch
from 'vue' are appropriate for the added functionality.
56-64
: Focus function implementation is correctThe
focus
function appropriately checks iffieldComponentRef
exists, has afocus
method, and is not already the active element before focusing. This ensures that focus is applied correctly without unnecessary refocusing.
169-179
: Watch onautofocus
property works as intendedThe
watch
function correctly observes changes tocomputedProps.value?.autofocus
and triggers thefocus
function when it becomestrue
, ensuring the component gains focus when needed. The use ofnextTick
and theimmediate: true
option is appropriate.
Description
添加表单form 控件聚焦配置
Type of change
Please delete options that are not relevant.
pnpm-lock.yaml
unless you introduce a new test example.Checklist
pnpm run docs:dev
command.pnpm test
.feat:
,fix:
,perf:
,docs:
, orchore:
.Summary by CodeRabbit
New Features
Bug Fixes