Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A <router-link> inside <b-nav-item> renders nested anchor tags#6216

emfluenceindia started this conversation inIdeas
Discussion options

When a<router-link> is placed inside a<b-nav-item>, it renders a nested anchor like this:

<li><a href="#"><a href="/" aria-current="page">Home</a></a></li>

According to HTML 5 standards nesting of hyperlinks is not allowed.

Since bootstrap-vue targets Vue, there is every possibility that a could be used inside in order to maintain the structure of the DOM.

I think if we can pass a prop with<b-nav-item>, say<b-nav-item vroute>, then we can decide what to render. This prop would be optional.

Ifvroute, then render like this:

<li><span><a href="/" aria-current="page">Home</a></span></li>

which is now valid as no nested anchor is there anymore.

Otherwise, render in usual way, i.e.

<li><a href="#"><a href="/" aria-current="page">Home</a></a></li>

It may not be super important at this stage and won't cause any real harm to an application, but it would surely be W3C and HTML5 standard compliance. Maybe giving it a thought is not a bad idea!

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hiws
Dec 16, 2020
Maintainer

It would be helpful if you posted the actual code you're using than the rendered HTML.

What's the reason you're placing a<router-link> inside<b-nav-item>?

<b-nav-item> supports creating a router-link if you use theto prop.
https://bootstrap-vue.org/docs/components/nav#comp-ref-b-nav-item

You can read more about which components supports creating router links here:
https://bootstrap-vue.org/docs/reference/router-links#common-router-link-props

You must be logged in to vote
1 reply
@emfluenceindia
Comment options

Thank you@Hiws 👍

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
2 participants
@emfluenceindia@Hiws

[8]ページ先頭

©2009-2025 Movatter.jp