Using SiteNavigationElement in mega menu - html

Guys i have a couple of unclearities.
Am optimising my website for google and i start to use strured data.
First question:
My site have main menu with sub menu and that sub manues have own sub menues etc...
Does all sub menues also need to have declared itemscope itemtype="http://www.schema.org/SiteNavigationElementor just parent need to have?
Check my example below:
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name"><a itemprop="url" href="#">Car Parts</a></li>
<li itemprop="name">
<a itemprop="url" href="#">Car Models</a>
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement" class="dropdown"> <!-- THIS -->
<li itemprop="name"><a itemprop="url" href="#">Sub menu</a></li>
</ul>
</li>
</ul>
Or just need like this
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name"><a itemprop="url" href="#">Car Parts</a></li>
<li itemprop="name">
<a itemprop="url" href="#">Car Models</a>
<ul class="dropdown"> <!-- THIS -->
<li itemprop="name"><a itemprop="url" href="#">Sub menu</a></li>
</ul>
</li>
</ul>
Second question
<li itemprop="name"> value of itemprop is name. Does this need to stay with name value or i need to change name => Car Models ?
<a itemprop="url"> does url need to change with my www.example.com/category or just leave url?
Thanks

<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name"><a itemprop="url" href="#">Car Parts</a></li>
<li class="dropdown">
<a class="dropdown-toggle" href="#">Car Models</a>
<ul class="dropdown-menu">
<li class="nav-item" itemprop="name">
<a class="dropdown-item nav-link" itemprop="url" href="https://stackoverflow.com">stackoverflow</a>
</li>
</ul>
</li>
</ul>
Itemprop should be defined on the navigation items and not the dropdown containers. You also do not need to repeat the schema declaration nor do you need to redeclare the itemscope.
Also, itemprop="" is defining what type of property the dom item is defining. So it should stay as "name" and "url".
here is a Mozilla article explaining itemprop: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemprop

Related

Structued data in a menu

How do you add url item props in a menu after the first li element. I cant seem to get google to pick up my next item props after the first menu list.
<li itemtype="http://schema.org/LocalBusiness" id="main"> <a> home</a>
<ul id=" subnav" =""="">
<li> <a itemprop="url" href="">Item 1</a>
</li>
<li><a itemprop="url" href="">Item 2</a>
</li>
<li><a itemprop="url" href="">Item 3</a>
</li>
</ul>
</li>
<li id="two">
<a>hello</a>
<ul id="subnav1">
<li>Menu 2
</li>
<li><a itemprop="url" href=""> Item 4 Not being picked up</a>
</li>
</ul>
</li>

ARIA and pagination

I would like to get some advice on WAI-ARIA markup I have added to my paginated post navigation.
Does this look correct, am I missing anything?
Should anything be added/removed to the current page link (#2)?
Also, curious on my "Page Count" and "View All" sections what if anything can be added to make it more ARIA-friendly.
<nav role="navigation" class="post-navigation">
<ul role="menubar" class="pagination">
<!-- Page Count -->
<span class="page-count">Page 2 of 4 </span>
<li aria-label="Previous">
<a role="menuitem" aria-posinset="1" data-pagenum="1" href="#">
<span aria-hidden="true">«</span>
</a>
</li>
<li>
<a role="menuitem" aria-posinset="1" data-pagenum="1" href="">1</a>
</li>
<li class="active">
<span role="menuitem" aria-posinset="2">2</span>
</li>
<li>
<a role="menuitem" aria-posinset="3" data-pagenum="3" href="#">3</a>
</li>
<li>
<a role="menuitem" aria-posinset="4" data-pagenum="4" href="#">4</a>
</li>
<li aria-label="Next">
<a role="menuitem" aria-posinset="3" data-pagenum="3" href="#">
<span aria-hidden="true">»</span>
</a>
</li>
<!-- View All link handing -->
<li aria-label="View All">
<a role="menuitem" href="#?viewall">View All</a>
</li>
</ul>
</nav>

Bootstrap 3: Navbar Tabs Equal to Page Width

I'm trying to create spaced tabs. I want about 6-8 of them running across the width of the screen, each with equal distance apart from each other. I also need them to have dropdown ability on hover.
Initially I went with Bootstrap 3 for quick and fast tabs. However, I can't seem to get them to space equally across the width of the page.
Alternatively, I found this awesome snippet of code which is pure css. However, I'm far from a css wizard and making a pure dropdown like the tabs would take me a long time.
Anyone know a solution to the bootstrap 3 problem of spacing or know where I can get a pure css dropdown solution? Bootstrap 3 code below, pure css in jsfiddle link
Thanks!
Code:
<ul class='nav nav-tabs'>
<li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>Test 1</a>
<ul class='dropdown-menu'>
<li><a href='#'>test 1</a></li>
</ul>
</li>
<li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>Test 2</a>
<ul class='dropdown-menu'>
<li><a href='#'>test 2</a></li>
</ul>
</li>
<li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>Test 3</a>
<ul class='dropdown-menu'>
<li><a href='#'>test 3</a></li>
</ul>
</li>
</ul>
You can enclose your code inside a div with container-fluid class. It will help you to utilize entire width of apge.
ul.nav-tabs > li {
width: 33%;
text-align: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<ul class='nav nav-tabs'>
<li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>Test 1</a>
<ul class='dropdown-menu'>
<li><a href='#'>test 1</a>
</li>
</ul>
</li>
<li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>Test 2</a>
<ul class='dropdown-menu'>
<li><a href='#'>test 2</a>
</li>
</ul>
</li>
<li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>Test 3</a>
<ul class='dropdown-menu'>
<li><a href='#'>test 3</a>
</li>
</ul>
</li>
</ul>
</div>

HTML5 validation on ARIA trees

I am using http://validator.w3.org/nu/ to perform HTML5 validation on my document. I don't understand why I get a validation error on the following code. I checked http://www.w3.org/TR/wai-aria/roles#treeitem and thought it was ok to place an li element with role="treeitem" inside an element ul with role="group". The nu validator tells me it is not allowed. I'd like to know if nu validator is correct in his verdict, and if so, where can we find the information about the schema for ARIA trees that stipulates that. Thank you.
Sample code that does not validate:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Trees</title>
</head>
<body>
<h1 id="label_1">Fruits and vegetables</h1>
<ul id="tree" role="tree" tabindex="0" aria-labelledby="label_1">
<li role="treeitem" aria-expanded="true">
Fruits
<ul id="tree1_1" role="group">
<li role="treeitem">Oranges</li>
<li role="treeitem">Apples</li>
</ul>
</li>
<li role="treeitem">
Vegetables
<ul id="tree1_2" role="group">
<li role="treeitem">Carrots</li>
</ul>
</li>
</ul>
</body>
</html>
role="group" is definitely allowed on ul elements. The HTML5 spec currently reflects this as well. Validator.w3.org/nu/ and http://validator.w3.org/ both corectly treat this as valid. Validator.nu still seems to flag it as invalid though.
Regardless of validation, using nested trees is not the right choice here. It might pass the validator, but that's most likely just because it's allowed to nest widgets (just like you can have a slider or text field nested in a tree item). But they are still treated as separate widgets, not as the single, composite widget that a tree is supposed to be. The inner tree would not be part of the outer tree's structure, it would just be just a separate widget that happens to be nested in one of its tree items.
On your line 13 and line 19 you need to have role = tree and not role=group
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Trees</title>
</head>
<body>
<h1 id="label_1">Fruits and vegetables</h1>
<ul id="tree" role="tree" tabindex="0" aria-labelledby="label_1">
<li role="treeitem" aria-expanded="true">
Fruits
<ul id="tree1_1" role="tree">
<li role="treeitem">Oranges</li>
<li role="treeitem">Apples</li>
</ul>
</li>
<li role="treeitem">
Vegetables
<ul id="tree1_2" role="tree">
<li role="treeitem">Carrots</li>
</ul>
</li>
</ul>
The validator does choke on role=group because of Group Definition and if you read between the lines the list items are not in there. you have treeitem in your list so role would be tree and not group.
Interesting question. The validator behaviour does seem a bit odd. The WAI-ARIA spec does seem to allow group as a container for treeitem.
On the other hand the HTML5 spec does not allow "group" to be a role on the <ul> element. It must be either "directory", "list", "listbox", "menu", "menubar", "tablist", "toolbar", "tree" or "presentation"; yet the validator does not complain about that.
Either way, it seems you should use "tree" rather than "group".
<div role="application">
<h2 id="label_1">Foods</h2>
<ul id="tree1" class="tree" role="tree" aria-labelledby="label_1">
<li id="fruits" role="treeitem" tabindex="0" aria-expanded="true">Fruits
<ul role="group">
<li id="oranges" role="treeitem" tabindex="-1">Oranges</li>
<li id="pinapples" role="treeitem" tabindex="-1">Pineapples</li>
<li id="apples" role="treeitem" tabindex="-1" aria-expanded="false">Apples
<ul role="group">
<li id="macintosh" role="treeitem" tabindex="-1">Macintosh</li>
<li id="granny_smith" role="treeitem" tabindex="-1" aria-expanded="false">Granny Smith
<ul role="group">
<li id="Washington" role="treeitem" tabindex="-1">Washington State</li>
<li id="Michigan" role="treeitem" tabindex="-1">Michigan</li>
<li id="New_York" role="treeitem" tabindex="-1">New York</li>
</ul>
</li>
<li id="fuji" role="treeitem" tabindex="-1">Fuji</li>
</ul>
</li>
<li id="bananas" role="treeitem" tabindex="-1">Bananas</li>
<li id="pears" role="treeitem" tabindex="-1">Pears</li>
</ul>
</li>
<li id="vegetables" role="treeitem" tabindex="-1" aria-expanded="true">Vegetables
<ul role="group">
<li id="broccoli" role="treeitem" tabindex="-1">Broccoli</li>
<li id="carrots" role="treeitem" tabindex="-1">Carrots</li>
<li id="lettuce" role="treeitem" tabindex="-1" aria-expanded="false">Lettuce
<ul role="group">
<li id="romaine" role="treeitem" tabindex="-1">Romaine</li>
<li id="iceberg" role="treeitem" tabindex="-1">Iceberg</li>
<li id="butterhead" role="treeitem" tabindex="-1">Butterhead</li>
</ul>
</li>
<li id="spinach" role="treeitem" tabindex="-1">Spinach</li>
<li id="squash" role="treeitem" tabindex="-1" aria-expanded="true">Squash
<ul role="group" >
<li id="acorn" role="treeitem" tabindex="-1">Acorn</li>
<li id="ambercup" role="treeitem" tabindex="-1">Ambercup</li>
<li id="autumn_cup" role="treeitem" tabindex="-1">Autumn Cup</li>
<li id="hubbard" role="treeitem" tabindex="-1">Hubbard</li>
<li id="kobacha" role="treeitem" tabindex="-1">Kabocha</li>
<li id="butternut" role="treeitem" tabindex="-1">Butternut</li>
<li id="spaghetti" role="treeitem" tabindex="-1">Spaghetti</li>
<li id="sweet_dumpling" role="treeitem" tabindex="-1">Sweet Dumpling</li>
<li id="turban" role="treeitem" tabindex="-1">Turban</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>

Twitter Bootstrap navigation dividers not working properly for google chrome

My navigation bar isn't displaying the dividers for every subpage element. This is only happening in google chrome,not IE or FF. Here is an image (click here for larger size of image):
Here is my HTML code:
<li class="dropdown">
<a href="/jrknet/www/company" class="dropdown-toggle" data-toggle="dropdown" data-target="#">
Company
<b class="caret">
</b>
</a>
<ul class="dropdown-menu">
<li>
<a href="/jrknet/www/company/about-us">
About us
</a>
</li>
<li class="divider">
</li>
<li>
<a href="/jrknet/www/company/meet-the-team">
Meet the Team
</a>
</li>
<li class="divider">
</li>
<li>
<a href="/jrknet/www/company/mission-statement">
Mission Statement
</a>
</li>
<li class="divider">
</li>
<li>
<a href="/jrknet/www/company/development-methodology">
Development Methodology
</a>
</li>
<li class="divider">
</li>
<li>
<a href="/jrknet/www/company/quality-management">
Quality Management
</a>
</li>
<li class="divider">
</li>
<li>
<a href="/jrknet/www/company/business-continuity">
Business Continuity
</a>
</li>
</ul>
You can check zoom-in and zoom-out when such issues arise..
i don't find any problem with the code..
Moreover, if the problem remains, you can try changing your display resolution..