Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Accessibility] Avoid empty th in doc-table header row #12364

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/ui/public/doc_table/__tests__/lib/rows_headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Doc Table', function () {

it('should create a time column if the timefield is defined', function () {
const childElems = parentElem.find(elemType);
expect(childElems.length).to.be(2);
expect(childElems.length).to.be(1);
});

it('should be able to add and remove columns', function () {
Expand All @@ -61,28 +61,28 @@ describe('Doc Table', function () {
$parentScope.columns = ['bytes'];
parentElem.scope().$digest();
childElems = parentElem.find(elemType);
expect(childElems.length).to.be(3);
expect($(childElems[2]).text()).to.contain('bytes');
expect(childElems.length).to.be(2);
expect($(childElems[1]).text()).to.contain('bytes');

$parentScope.columns = ['bytes', 'request_body'];
parentElem.scope().$digest();
childElems = parentElem.find(elemType);
expect(childElems.length).to.be(4);
expect($(childElems[3]).text()).to.contain('request_body');
expect(childElems.length).to.be(3);
expect($(childElems[2]).text()).to.contain('request_body');

$parentScope.columns = ['request_body'];
parentElem.scope().$digest();
childElems = parentElem.find(elemType);
expect(childElems.length).to.be(3);
expect($(childElems[2]).text()).to.contain('request_body');
expect(childElems.length).to.be(2);
expect($(childElems[1]).text()).to.contain('request_body');
});

it('should create only the toggle column if there is no timeField', function () {
delete parentElem.scope().indexPattern.timeFieldName;
parentElem.scope().$digest();

const childElems = parentElem.find(elemType);
expect(childElems.length).to.be(1);
expect(childElems.length).to.be(0);
});

};
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('Doc Table', function () {
});

describe('adding and removing columns', function () {
columnTests('th', $elem);
columnTests('[data-test-subj~="docTableHeaderField"]', $elem);
});

describe('cycleSortOrder function', function () {
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('Doc Table', function () {
});

describe('adding and removing columns', function () {
columnTests('td', $elem);
columnTests('[data-test-subj~="docTableField"]', $elem);
});

describe('details row', function () {
Expand Down
14 changes: 11 additions & 3 deletions src/ui/public/doc_table/components/table_header.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<tr>
<th width="1%"></th>
<th ng-if="indexPattern.timeFieldName" data-test-subj="docTableHeaderField">
<td width="1%"></td>
<th
ng-if="indexPattern.timeFieldName"
data-test-subj="docTableHeaderField"
scope="col"
>
<span>Time <button
id="docTableHeaderFieldSort{{indexPattern.timeFieldName}}"
tabindex="0"
Expand All @@ -13,7 +17,11 @@
></button>
</span>
</th>
<th ng-repeat="name in columns" data-test-subj="docTableHeaderField">
<th
ng-repeat="name in columns"
data-test-subj="docTableHeaderField"
scope="col"
>
<span class="table-header-name">
{{name | shortDots}}
<button
Expand Down