Skip to content

Unexpected behaviour when a tag is given a username or password attribute #10498

Open
@Ross-Alexandra

Description

@Ross-Alexandra

Vue version

3.4.21

Link to minimal reproduction

https://play.vuejs.org/#eNp9kctOwzAQRX8leE0T8VhFoRJUXYDEQ8DSEnLTaeLW8Rh73FRU/XfGqVq6QN2N771jnxlvxb1z+TqCKEUVaq8dZQEourG0VbEXuOQDQeeMIuBTllUqaz0s7qRoiVwoi6Lv+7xBbAzkNXZSZDGAt6oDziwQZ8qz5lQIPfo5azP1w0LADkZILfiRIvJ6Fik1fMeNFOOJ0fUqe4aLqlADzgmCuBQUarQL3eTLgJbxtwlMCn7daQP+1ZFGG6Qos8FJnjIG+6dBIx/h8qDXLdSrf/RlYI6SizcPPM4apDh6pHwDtLenHy+w4fpodjiPhtNnzHcIaGJi3Mceop0z9kluoH3sHHrStvkM0w2BDYehEmhK7oa8FPyHkzOj/+He5LdDn7Q73uLXGny6kxfIRn59JXa/+CuwQQ==

Steps to reproduce

  1. Inspect the a tag in the DOM

What is expected?

The username and password attributes fall-through to the underlying a element in the DOM like in vanilla-HTML.

Here's an example fiddle showcasing what I was expected: https://codepen.io/Ross-Alexandra/pen/VwNagGR. If you inspect the a here, you'll see the username, password, and some-other-attribute attributes directly in the DOM.

What is actually happening?

The username & password attributes are being consumed, and prepended to the href as the authentication-part of the URL (ex: <a href="https://foobar:[email protected]"> is being rendered instead of <a href="https://www.google.com" username="foobar" password="baz">).

System Info

No response

Any additional comments?

I ran into this during a migration from Vue 2.7 to Vue 3.1. At some point when our codebase was still on Vue 2.x, we made a refactor which caused one of our components to no longer accept a username prop. This refactor wasn't properly completed however, as some of the references to that component were still passed a username. The root of that component is an a tag, so the username prop being passed to the component fell through to an attribute on the underlying a tag. This bug was then encountered, as that username attribute was prepended onto the href.

If this is working as intended, I was unable to find any documentation pointing this out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    need guidanceThe approach/solution in the PR is unclear and requires guidance from maintainer to proceed further.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions