Skip to content

Fixed fallthrough attr issue in Datetimepicker#4301

Open
unaipme wants to merge 1 commit into
buefy:devfrom
unaipme:fix-datetimepicker-fallthrough-attrs
Open

Fixed fallthrough attr issue in Datetimepicker#4301
unaipme wants to merge 1 commit into
buefy:devfrom
unaipme:fix-datetimepicker-fallthrough-attrs

Conversation

@unaipme

@unaipme unaipme commented Feb 14, 2026

Copy link
Copy Markdown

Fixes #4039.

The issue can still be reproduced with Buefy 3.0.4 in this codesandbox.

Proposed fix

I just propagated the $attrs to the <b-datepicker> inside DateTimePicker, giving priority to the datepicker prop over $attrs. I figured the datepicker prop is used in cases where the user might need more fine grained control over the <b-datepicker>, and thus it should prevail over fallthrough attributes that they might have less control over. If you disagree on this, we can change it :)

I already voiced my concerns in #4272 regarding how the fallback attributes are implemented, through CompatFallthroughMixin. I'm not here to discuss that, because it looks like a heavy discussion.

But while the matter is unresolved, I figured that DateTimePicker should at least behave consistently when compared with the other components. As can be seen in the codesandbox linked above, id usually stays on the top most element of the template, whereas the name usually falls down to the <input>. The change in this PR brings that behavior to DateTimePicker.

@netlify

netlify Bot commented Feb 14, 2026

Copy link
Copy Markdown

Deploy Preview for buefyv3 ready!

Name Link
🔨 Latest commit c11a4ca
🔍 Latest deploy log https://app.netlify.com/projects/buefyv3/deploys/69902b693f7685000853bf42
😎 Deploy Preview https://deploy-preview-4301--buefyv3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses native attribute fallthrough inconsistencies in BDatetimepicker by forwarding $attrs to the internal <b-datepicker> so attributes like name/id behave more like BDatepicker.

Changes:

  • Forward $attrs to the embedded <b-datepicker> in Datetimepicker.vue via an object merge with the datepicker prop.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ref="datepicker"
v-model="computedValue"
v-bind="datepicker"
v-bind="{...datepicker, ...$attrs}"

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

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

The spread order here gives $attrs precedence over the datepicker prop ({...datepicker, ...$attrs}), which is the opposite of what the PR description says and makes it impossible for datepicker to override conflicting native attrs (e.g. id, name). Swap the merge order so datepicker wins on conflicts (or update the PR intent/docs if $attrs should override).

Suggested change
v-bind="{...datepicker, ...$attrs}"
v-bind="{...$attrs, ...datepicker}"

Copilot uses AI. Check for mistakes.
ref="datepicker"
v-model="computedValue"
v-bind="datepicker"
v-bind="{...datepicker, ...$attrs}"

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

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

This change fixes a regression/behavior gap around fallthrough attrs, but there’s no test asserting that $attrs like id/name applied to <b-datetimepicker> end up on the rendered <input> (and that datepicker overrides $attrs on conflicts). Add a unit test in Datetimepicker.spec.ts to lock in the expected forwarding/precedence behavior.

Suggested change
v-bind="{...datepicker, ...$attrs}"
v-bind="{...$attrs, ...datepicker}"

Copilot uses AI. Check for mistakes.
@wesdevpro wesdevpro self-requested a review June 7, 2026 19:18
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.

Native attributes don't work on Datetimepicker

3 participants