This is because the nav element is defined in the Sections section of the HTML5 specification , and sections are expected to have headers.
Regarding the outline of the document:
The outline of a sectioning content element or root sectioning element consists of a list of one or more potentially nested sections. A section is a container that corresponds to some nodes in the source DOM tree. Each section can have one heading associated with it , and can contain any number of additional sub-sections.
- 4.3.10.1 Creating an outline - HTML5 specification
Note that the word may - they are not required. If they were necessary, the validator would throw warnings and errors, rather than a few friendly notes, to remind you that the title is missing.
So, to answer your questions:
Why is this circuit, including this?
This is just a friendly reminder that there is no title. Just in case, you expected the title to be present, but you, for example, forgot to add it.
What is the correct way to add a title to a nav element?
It completely depends on what you want to achieve. The HTML5 specification itself gives the following example:
<nav> <h1>Navigation</h1> <ul>...</ul> </nav>
Do I need to add a title to the nav element? because itβs not like the usual practice on most websites.
Not at all. This is completely optional. Some may argue that it would be useful for SEO to add a title to all sections, but that is entirely up to you. You can always hide the title with CSS if you want to add them, but do not want to display them.