Is the tabbing sequence logical?in HTML - html

Hi I am facing a very hard issue regarding tab order for accessibility.My tabs are functioned through jquery.ui.min.js. Tab order,classes & function are coming from there.Although all tabs are functioning properly but when i validate i am getting accessibility issue.Please suggest me other way.
I am looking for accessibility point of view only.One more thing this library adding blank style (style="") on every element.How can i remove it Please suggest.
<div class="tabs ui-tabs ui-widget ui-widget-content ui-corner-all" style="padding: 10px;">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" style="">
<li tabindex="0" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active" aria-controls="tab-content4" aria-selected="true" style="z-index: 2147483646;">tab1</li>
<li tabindex="-1" class="ui-state-default ui-corner-top" aria-controls="tab-content1" aria-selected="false" style="">tab2</li>
<li tabindex="-1" class="ui-state-default ui-corner-top" aria-controls="tab-content2" aria-selected="false" style="">tab3</li>
<li tabindex="-1" class="ui-state-default ui-corner-top" aria-controls="tab-content3" aria-selected="false" style="">tab4</li>
<!-- <li>Others</li> -->
</ul>
<strong style=""> <a class="fl_r" href="#" style="">Subscribe
</a></strong>
<div id="tab-content4" class="tab-content ui-tabs-panel ui-widget-content ui-corner-bottom" aria-expanded="true" aria-hidden="false" style="">
<table class="ui-table" style="border-collapse: collapse;">
<tbody style="">
<tr style="">
<td>test1</td>
</tr>
<tr style="">
<td>test2</td>
</tr>
<tr style="">
<td>test3</td>
</tr>
</tbody>
</table>
</div>
<div id="tab-content1" class="tab-content ui-tabs-panel ui-widget-content ui-corner-bottom" aria-expanded="false" aria-hidden="true" style="display: none;">
<table class="ui-table" style="border-collapse: collapse;">
<tbody style="">
<tr style="">
<td>test2</td>
</tr>
<tr style="">
<td>test21</td>
</tr>
<tr style="">
<td>test22</td>
</tr>
</tbody>
</table>
</div>
<div id="tab-content2" class="tab-content ui-tabs-panel ui-widget-content ui-corner-bottom" aria-expanded="false" aria-hidden="true" style="display: none;">
<table class="ui-table" style="border-collapse: collapse;">
<tbody style="">
<tr style="">
<td>test3</td>
</tr>
<tr style="">
<td>test31</td>
</tr>
<tr style="">
<td>test32</td>
</tr>
</tbody>
</table>
</div>
<div id="tab-content3" class="tab-content ui-tabs-panel ui-widget-content ui-corner-bottom" aria-expanded="false" aria-hidden="true" style="display: none;">
<table class="ui-table" style="border-collapse: collapse;">
<tbody style="">
<tr style="">
<td>test4</td>
</tr>
<tr style="">
<td>test41</td>
</tr>
<tr style="">
<td>test42</td>
</tr>
</tbody>
</table>
</div>
<!-- <div id="tab-content4" class="tab-content">&nbsp;</div> -->
</div>

When running the siteimprove plugin, you will get a "review" item (not an "error" or "warning") for any element that has a tabindex specified. Or at least that's what my testing is showing.
It doesn't seem to matter if valid tabindex values of 0 or -1 are used. I would expect a "review" or "warning" if tabindex were greater than 0 since that's highly discouraged in the html spec.
Warning!Using a positive value for tabindex to specify the element’s position in the sequential focus navigation order interacts with the order of all focusable elements. It is error-prone, and therefore not recommended. Authors should generally leave elements to appear in their default order.
So siteimprove is being a bit overzealous and flagging every use of tabindex as a review candidate.
Note that in your example, the tabindex="0" on all the <a> elements is not necessary (*). They are already in the tab sequence.
(*) If an anchor (<a>) does not have an href attribute, then the anchor is not a tabstop and would need a tabindex="0" if you wanted focus to move to the element. However, the anchor would also need a keyboard and mouse event handler to handle clicks since an anchor without an href does not handle any events.
The code sample is also a little weird in that the list item (<li>) has a tabindex="0" and the nested link in that list item allows focus. That's two tab stops for essentially the same element. That would be an accessibility issue.

Related

Prevent scroll when children select clicked

Have structure like this
<div style="overflow-x:auto; overflow-y: hidden; width: 100%; white-space: nowrap;">
<table>
<tbody>
<tr>
<td>
<select>
*some options*
</select>
</td>
</tr>
</tbody>
</table>
</div>
And when i clicked select first time scroll resets to leftmost position. When i clicked it 2nd time it stays at the current position. This selects created by Chosen library and for real looks like
<div class="chzn-container chzn-container-single chzn-container-single-nosearch" style="width: 215px;" title="">
<a class="chzn-single" tabindex="-1">
<span>selected option</span>
</a>
<div class="chzn-drop"><div class="chzn-search">
<input type="text" autocomplete="off" readonly="">
</div>
<ul class="chzn-results">
<li class="active-result result-selected" style="" data-option-array-index="0">Option2</li>
<li class="active-result" style="" data-option-array-index="1">Option3</li>
<li class="active-result" style="" data-option-array-index="2">Option4</li>
</ul>
</div>
</div>
Trouble was in .focus method on Chosen library. Close to dropdown method. Just comment this and it stop reseting scroll

How to click a dropdown arrow in extJS using Python and Selenium?

The full HTML code for the table is as follows:
<table id="clearablecombo-1497" class="x-field clearableCombo x-form-item x-field-default x-anchor-form-item" cellpadding="0" style="table-layout: fixed; width: 287px;">
<tbody>
<tr id="clearablecombo-1497-inputRow">
<td id="clearablecombo-1497-labelCell" class="x-field-label-cell" width="105" valign="top" halign="right" style="">
<label id="clearablecombo-1497-labelEl" class="x-form-item-label x-form-item-label-right" style="width:100px;margin-right:5px;" for="clearablecombo-1497-inputEl">Document Status:</label>
</td>
<td id="clearablecombo-1497-bodyEl" class="x-form-item-body x-form-trigger-wrap-focus" colspan="2" role="presentation" style="width: 100%;">
<table id="clearablecombo-1497-triggerWrap" class="x-form-trigger-wrap" cellspacing="0" cellpadding="0" style="width: 100%; table-layout: fixed;">
<tbody>
<tr>
<td id="clearablecombo-1497-inputCell" class="x-form-trigger-input-cell" style="width: 100%;">
<div id="ext-gen1890" class="x-hide-display x-form-data-hidden" role="presentation"/>
<input id="clearablecombo-1497-inputEl" class="x-form-field x-form-text x-form-focus x-field-form-focus x-field-default-form-focus" type="text" style="width: 100%; text-transform: uppercase; -moz-user-select: text;" name="documentStatus" autocomplete="off" aria-invalid="false"/>
</td>
<td id="ext-gen1888" class="x-trigger-cell" valign="top" style="width:26px">
<div id="ext-gen1886" class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-unselectable x-form-trigger-over x-form-arrow-trigger-over" role="button" style="-moz-user-select: none;"/>
</td>
<td id="ext-gen1889" class="x-trigger-cell" valign="top" style="width:26px">
<div id="ext-gen1887" class="x-trigger-index-1 x-form-trigger x-form-clear-trigger x-form-trigger-last x-unselectable" role="button" style="-moz-user-select: none;"/>
</td>
</tr>
</tbody>
</table>
</td>
<td id="clearablecombo-1497-errorEl" class="x-form-error-msg x-external-error-icon x-form-invalid-icon" width="0" style="display:none" data-errorqtip=""/>
</tr>
</tbody>
</table>
The part of the HTML I'm attempting to manipulate is this part specifically:
<div id="ext-gen1886" class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-unselectable x-form-trigger-over x-form-arrow-trigger-over" role="button" style="-moz-user-select: none;"/>
The above part is the actual dropdown arrow which is also in the above large portion of the HTML. The drop down text I need to select is "Rejected". The HTML with the selection options are as follows:
<div id="boundlist-1558" class="x-boundlist x-boundlist-floating x-layer x-boundlist-default" tabindex="-1" style="left: 136px; top: 346px; height: auto; z-index: 19001; width: 182px;">
<div id="boundlist-1558-listEl" class="x-boundlist-list-ct" style="overflow: auto; height: auto;">
<ul>
<li class="x-boundlist-item x-boundlist-item-over" role="option">All</li>
<li class="x-boundlist-item" role="option">Waiting QA</li>
<li class="x-boundlist-item" role="option">AutoTec Approved</li>
<li class="x-boundlist-item" role="option">User Approved</li>
<li class="x-boundlist-item" role="option">Rejected</li>
<li class="x-boundlist-item" role="option">Deleted</li>
</ul>
</div>
</div>
Anyone have any suggestions of the XPath I would use to do this? I tried just inputting the text like a textbox, however there are certain boxes such as the Country and State that have to be selected to enable each other.
I think 'role' is the best attr in this case to find the elements:
--this one select your desired element
"//div[contains(id, 'ext-gen')][#role='button'][contains(#class, 'x-form-trigger-over')]"
--this one select your desired option
"//li[#role='option'][text()='Rejected']"
As I understand these are the target elements:
xpath = '//div[contains(id, "ext-gen")][#class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-unselectable x-form-trigger-over x-form-arrow-trigger-over"]'
drop_down = self.driver.find_element_by_xpath(xpath)
drop_down.click()
xpath = '//li[#class="x-boundlist-item"][contains(text(), "Rejected")]'
option = self.driver.find_element_by_xpath(xpath)
option.click()

Bootstrap 2.3.2 split button dropdowns in tables line

The dropdown on the right is in a table cell, this works as intended on desktop browser.
However on mobile, on click, the dropdown gets split into two lines:
HTML
<table class="table table-striped table-bordered table-hover">
<tr>
<td> ... </td>
<td> ... </td>
<td> ... </td>
<td>
<div class="btn-group">
<i class="icon-eye-open icon-white"></i> Visualizza
<button class="btn dropdown-toggle btn-primary btn-small" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><i class="icon-pencil"></i> Modifica</li>
<li><a class="btn-confirm" href="#"><i class="icon-trash"></i> Elimina</a></li>
</ul>
</div>
</td>
</tr>
</table>
The problem most likely stems from the table cell width being laid out too short for both elements.
The simplest solution would be to set add a class to that cell and add min-width, though you would be moving away from pure bootstrap.
HTML:
<td> ... </td>
<td class="dropdownCell">
<div class="btn-group">
...
Css:
.dropdownCell { min-width:130px; }
Fiddle is here: http://jsfiddle.net/a4kx75t1/1/

ExtJs HTML/DOM code optimization

Spent already a lot of resources to figure out how to optimize extJs HTML code.
I have simple combobox with a label and extjs throw on a page this:
<tr role="presentation" id="inputs[1].TypeId-inputRow" class="x-form-item-input-row">
<td role="presentation" id="inputs[1].TypeId-labelCell" style="" valign="top" halign="left" width="88" class="x-field-label-cell">
<label
id="inputs[1].TypeId-labelEl"
for="inputs[1].TypeId-inputEl"
class="x-form-item-label x-unselectable x-form-item-label-left"
style="width:83px;margin-right:5px;" unselectable="on">
Placement ID:
</label>
</td>
<td role="presentation" class="x-form-item-body x-form-trigger-wrap-focus" id="inputs[1].TypeId-bodyEl" colspan="2">
<table id="inputs[1].TypeId-triggerWrap" class="x-form-trigger-wrap" cellpadding="0" cellspacing="0" style="table-layout: auto;">
<tbody>
<tr>
<td id="inputs[1].TypeId-inputCell" class="x-form-trigger-input-cell">
<div class="x-hide-display x-form-data-hidden" role="presentation" id="ext-gen1311">
</div>
<input
id="inputs[1].TypeId-inputEl"
type="text"
class="x-form-field x-form-required-field x-form-text x-trigger-noedit x-form-focus x-field-form-focus x-field-default-form-focus"
autocomplete="off"
name="inputs[1].TypeId"
placeholder="DATA SOURCE"
readonly="readonly"
aria-invalid="false"
data-errorqtip=""
style="width: 137px;">
</td>
<td valign="top" class=" x-trigger-cell x-unselectable" style="width:22px;" id="ext-gen1310">
<div class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-form-trigger-first" role="button" id="ext-gen1309">
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
How could I change tables inside a tables just for simple xtype: 'combobox'?
I have hundreds like that on a page, it slows down a lot because very heavy HTML code.
it could be done with simple div wit ha float on it, why does extJS renders all this table code?
If you want/need a simpler markup in Ext, the only way is to code your own component where you can define a simpler one.
There is no way of simplifying the Ext generated markup without a danger of breaking functionality or layout engine.

CSS dropdown menu Relative to a TD in a table

I have a table of records which is displayed nicely in a HTML Table.
The last column of this table displays a icon when hovering the row. When the user hovers the icon a drop down menu appears for all actions related to that row.
Currently I have the td that Icon is in set to Position:absolute and the div of the drop down menu is also set to Position Absolute.
This means I can align the Dropdown Menu Div to align nicely against the row it relates.
Firstly im not totally sure why this is the case. I would have thought I would need the TD as Absolute and the Menu Div as Relative but this just isnt the case.
The actual issue I am currently having (as the way I have it works across all browser) is that when the row is expanded to be double the height from text in other columns. The TD with absolute positioning applied does not expand to be 100% height of the TR. Which causes issues when trying to hover the tr and you move over where the last TD which should have expanded to the row height and it registers it as a hover out on the TR.
Any ideas to get around this?
The problem with putting the icon in a div which is relative is that I need the div to be 100% height/width of the td to be able to align the menu correct to the row!
EDIT:
As requested Some Html... This is a mustache template. Shouldn't be to hard to follow even if you have never used it
<table>
<thead>
<tr>
<th style="width:15px"><input type="checkbox" class="GridSelectAll" onclick="GridSelectAll(this);" /></th>
<th class="tar" style="width:30px">
<a href="javascript:SortGrid('EmployeeId')" id="headerEmployeeId">
<%= GetTranslation("EmployeeId") %><span class="sortArrow ui-icon"></span>
</a>
</th>
<th style="width:120px">
<a href="javascript:SortGrid('FirstName')" id="headerFirstName">
<%= GetTranslation("FirstName") %><span class="sortArrow ui-icon"></span>
</a>
</th>
<th style="width:120px">
<a href="javascript:SortGrid('LastName')" id="headerLastName">
<%= GetTranslation("LastName") %><span class="sortArrow ui-icon"></span>
</a>
</th>
<th>
<a href="javascript:SortGrid('CompanyName')" id="headerCompanyName">
<%= GetTranslation("PrimayCompanyName") %><span class="sortArrow ui-icon" ></span>
</a>
</th>
<th style="width:55px">
<a href="javascript:SortGrid('EmployeeRowStatus')" id="headerEmployeeRowStatus">
<%= GetTranslation("EmployeeRowStatus") %><span class="sortArrow ui-icon"></span>
</a>
</th>
<th style="width:60px">
<a href="javascript:SortGrid('IsLocked')" id="headerIsLocked">
<%= GetTranslation("IsLocked") %><span class="sortArrow ui-icon"></span>
</a>
</th>
<th style="width:15px"></th>
</tr>
</thead>
<tbody>
{{#EmployeeSummaries}}
<tr>
<td><input type="checkbox" class="chkRowId" value="{{EmployeeId}}" /></td>
<td class="tar">{{EmployeeId}}</td>
<td>{{FirstName}}</td>
<td>{{LastName}}</td>
<td>{{PrimaryCompanyName}}</td>
<td>{{EmployeeRowStatus}}</td>
<td>{{IsLocked}}</td>
<td style="position:absolute;">
<a class="optlink"><span class="ui-icon ui-icon-triangle-1-s"></span></a>
<div class="optmenu">
<ul>
<li><a onclick="UpdateEmployee_LoadDialog({{EmployeeId}});"><%= GetTranslation("ManageEmployee")%></a></li>
<li><a onclick="showLoading();" href="../Core/AuditItem.aspx?{{ItemTypeItemIdQuerystring}}"><%= GetTranslation("ViewHistory")%></a></li>
<li><a onclick="showLoading();" href="UserGroupsEvo.aspx#/?PageIndex=0&Filter=EmployeeId~EqualTo~{{EmployeeId}}"><%= GetTranslation("ViewUserGroups")%></a></li>
<li><a onclick="showLoading();" href="UserGroup_Employees.aspx?{{EmployeeIdQuerystring}}"><%= GetTranslation("ManageUserGroups")%></a></li>
<li><a onclick="showLoading();" href="../Employee/EmployeePreferences.aspx?{{EmployeeIdQuerystring}}"><%= GetTranslation("ManagePreferences")%></a></li>
<li><a onclick="ResetPasswords_LoadDialog({{EmployeeId}});"><%= GetTranslation("ResetPassword")%></a></li>
<li><a onclick="SendWelcomeEmails_LoadDialog({{EmployeeId}});"><%= GetTranslation("SendWelcomeEmail")%></a></li>
<li><a onclick="AddEmployee_Company_LoadDialog({{EmployeeId}}, {{PrimaryCompanyId}});"><%= GetTranslation("AddToCompany")%></a></li>
<li><a onclick="LoginAsUser({{EmployeeId}});"><%= GetTranslation("LoginAsUser") %></a></li>
{{#HasOtherCompanies}}
<li class="subheader"><%= GetTranslation("ManageOtherCompanies") %></li>
{{/HasOtherCompanies}}
{{#Companies}}
<li>
<span style="vertical-align:top;" class="hh ui-icon ui-icon-circle-close" onclick='RemoveEmployeeFromCompany_LoadDialog(this, {{EmployeeId}}, {{CompanyId}}, "{{CompanyName}}");return false;' title="<%= GetTranslation("Remove") %>"></span>
<a onclick="ManageEmployee_Company_LoadDialog({{EmployeeId}}, {{CompanyId}});">
{{CompanyName}}
</a>
</li>
{{/Companies}}
</ul>
</div>
</td>
</tr>
{{/EmployeeSummaries}}
</tbody>
</table>
I would get rid of the table all together. I would then use divs with table behavior. This will give you much more control over how each element works, each row, and each column.
This link explains the concept quite well: http://snook.ca/archives/html_and_css/getting_your_di
You might try this::
<!DOCTYPE html>
<html>
<head>
<style>
body{font-family:arial;}
table{font-size:80%;background:black}
a{color:black;text-decoration:none;font:bold}
a:hover{color:#606060}
td.menu{background:lightblue}
table.menu
{
font-size:100%;
position:absolute;
visibility:hidden;
}
</style>
<script>
function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden";
}
</script>
</head>
<body>
<h3>Drop down menu</h3>
<table width="100%">
<tr bgcolor="#FF8080">
<td onmouseover="showmenu('tutorials')" onmouseout="hidemenu('tutorials')">
Tutorials<br>
<table class="menu" id="tutorials" width="120">
<tr><td class="menu">HTML</td></tr>
<tr><td class="menu">CSS</td></tr>
<tr><td class="menu">XML</td></tr>
<tr><td class="menu">XSL</td></tr>
</table>
</td>
<td onmouseover="showmenu('scripting')" onmouseout="hidemenu('scripting')">
Scripting<br>
<table class="menu" id="scripting" width="120">
<tr><td class="menu">JavaScript</td></tr>
<tr><td class="menu">VBScript</td></tr>
<tr><td class="menu">DHTML</td></tr>
<tr><td class="menu">ASP</td></tr>
<tr><td class="menu">ADO</td></tr>
</table>
</td>
<td onmouseover="showmenu('validation')" onmouseout="hidemenu('validation')">
Validation<br>
<table class="menu" id="validation" width="120">
<tr><td class="menu">Validate HTML</td></tr>
<tr><td class="menu">Validate XHTML</td></tr>
<tr><td class="menu">Validate CSS</td></tr>
<tr><td class="menu">Validate XML</td></tr>
<tr><td class="menu">Validate WML</td></tr>
</table>
</td>
</tr>
</table>
<p>Mouse over these options to see the drop down menus</p>
</body>
</html>